Catching possible account errors (#3596)

Co-authored-by: David Bomba <turbo124@gmail.com>
This commit is contained in:
Benjamin Beganović 2020-04-06 23:23:57 +02:00 committed by GitHub
parent 4323968240
commit 0c7620a381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -41,8 +41,16 @@ class AuthService
$response = Request::post($this->getUrl(), $this->getHeaders(), $body);
if ($response->code == 200) {
$this->isSuccessful = true;
$this->token = $response->body->data[0]->token->token;
try {
$this->isSuccessful = true;
$this->token = $response->body->data[0]->token->token;
} catch (\Exception $e) {
info($e->getMessage());
$this->isSuccessful = false;
$this->errors = [trans('texts.migration_went_wrong')];
}
}
if (in_array($response->code, [401, 422, 500])) {

View File

@ -3535,6 +3535,7 @@ $LANG = array(
'marked_credit_as_sent' => 'Successfully marked credit as sent',
'email_subject_payment_partial' => 'Email Partial Payment Subject',
'is_approved' => 'Is Approved',
'migration_went_wrong' => 'Oops, something went wrong! Make sure you did proper setup with V2 of Invoice Ninja, before starting migration.',
'cross_migration_message' => 'Cross account migration is not allowed. Please read more about it here: <a href="https://invoiceninja.github.io/cross-site-migration.html">https://invoiceninja.github.io/cross-site-migration.html</a>'
);