1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #5824 from turbo124/v5-develop

Better error messaging
This commit is contained in:
David Bomba 2021-05-26 13:17:45 +10:00 committed by GitHub
commit dfab863c68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 11 deletions

View File

@ -425,13 +425,9 @@ class Import implements ShouldQueue
'*.first_name' => ['string'],
'*.last_name' => ['string'],
//'*.email' => ['distinct'],
'*.email' => ['distinct', 'email', new ValidUserForCompany(), new AttachableUser()],
'*.email' => ['distinct', 'email', new ValidUserForCompany()],
];
// if (config('ninja.db.multi_db_enabled')) {
// array_push($rules['*.email'], new ValidUserForCompany());
// }
$validator = Validator::make($data, $rules);
if ($validator->fails()) {

View File

@ -144,7 +144,7 @@ class StartMigration implements ShouldQueue
if(Ninja::isHosted())
app('sentry')->captureException($e);
Mail::to($this->user->email, $this->user->name())->send(new MigrationFailed($e, $this->company->settings, $e->getMessage()));
Mail::to($this->user->email, $this->user->name())->send(new MigrationFailed($e, $this->company, $e->getMessage()));
if (app()->environment() !== 'production') {
info($e->getMessage());

View File

@ -8,22 +8,23 @@ use Illuminate\Queue\SerializesModels;
class MigrationFailed extends Mailable
{
// use Queueable, SerializesModels;
public $exception;
public $content;
public $settings;
public $company;
/**
* Create a new message instance.
*
* @param $content
* @param $exception
*/
public function __construct($exception, $settings, $content = null)
public function __construct($exception, $company, $content = null)
{
$this->exception = $exception;
$this->content = $content;
$this->settings = $settings;
$this->settings = $company->settings;
$this->company = $company;
}
/**
@ -34,6 +35,6 @@ class MigrationFailed extends Mailable
public function build()
{
return $this->from(config('mail.from.address'), config('mail.from.name'))
->view('email.migration.failed', ['settings' => $this->settings]);
->view('email.migration.failed', ['settings' => $this->settings, 'company' => $this->company]);
}
}

View File

@ -3,7 +3,7 @@
@include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png'])
@endslot
<h1>Whoops, migration failed.</h1>
<h1>Whoops, migration failed for {{ $company->present()->name() }}.</h1>
<p>Looks like your migration failed. Here's the error message:</p>
<pre>