mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:17:30 -05:00 
			
		
		
		
	Merge pull request #5824 from turbo124/v5-develop
Better error messaging
This commit is contained in:
		
						commit
						dfab863c68
					
				@ -425,13 +425,9 @@ class Import implements ShouldQueue
 | 
				
			|||||||
            '*.first_name' => ['string'],
 | 
					            '*.first_name' => ['string'],
 | 
				
			||||||
            '*.last_name' => ['string'],
 | 
					            '*.last_name' => ['string'],
 | 
				
			||||||
            //'*.email' => ['distinct'],
 | 
					            //'*.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);
 | 
					        $validator = Validator::make($data, $rules);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($validator->fails()) {
 | 
					        if ($validator->fails()) {
 | 
				
			||||||
 | 
				
			|||||||
@ -144,7 +144,7 @@ class StartMigration implements ShouldQueue
 | 
				
			|||||||
            if(Ninja::isHosted())
 | 
					            if(Ninja::isHosted())
 | 
				
			||||||
                app('sentry')->captureException($e);
 | 
					                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') {
 | 
					            if (app()->environment() !== 'production') {
 | 
				
			||||||
                info($e->getMessage());
 | 
					                info($e->getMessage());
 | 
				
			||||||
 | 
				
			|||||||
@ -8,22 +8,23 @@ use Illuminate\Queue\SerializesModels;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class MigrationFailed extends Mailable
 | 
					class MigrationFailed extends Mailable
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    // use Queueable, SerializesModels;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $exception;
 | 
					    public $exception;
 | 
				
			||||||
    public $content;
 | 
					    public $content;
 | 
				
			||||||
    public $settings;
 | 
					    public $settings;
 | 
				
			||||||
 | 
					    public $company;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Create a new message instance.
 | 
					     * Create a new message instance.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param $content
 | 
					     * @param $content
 | 
				
			||||||
     * @param $exception
 | 
					     * @param $exception
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function __construct($exception, $settings, $content = null)
 | 
					    public function __construct($exception, $company, $content = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->exception = $exception;
 | 
					        $this->exception = $exception;
 | 
				
			||||||
        $this->content = $content;
 | 
					        $this->content = $content;
 | 
				
			||||||
        $this->settings = $settings;
 | 
					        $this->settings = $company->settings;
 | 
				
			||||||
 | 
					        $this->company = $company;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -34,6 +35,6 @@ class MigrationFailed extends Mailable
 | 
				
			|||||||
    public function build()
 | 
					    public function build()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this->from(config('mail.from.address'), config('mail.from.name'))
 | 
					        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]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,7 @@
 | 
				
			|||||||
        @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png'])
 | 
					        @include('email.components.header', ['logo' => 'https://www.invoiceninja.com/wp-content/uploads/2015/10/logo-white-horizontal-1.png'])
 | 
				
			||||||
    @endslot
 | 
					    @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>
 | 
					    <p>Looks like your migration failed. Here's the error message:</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <pre>
 | 
					    <pre>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user