1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/app/Exceptions/YodleeApiException.php

50 lines
1.0 KiB
PHP
Raw Normal View History

2022-08-11 06:19:35 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2024-04-12 06:15:41 +02:00
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
2022-08-11 06:19:35 +02:00
namespace App\Exceptions;
use Exception;
2023-07-25 12:04:04 +02:00
use Illuminate\Http\JsonResponse;
2023-10-26 04:57:44 +02:00
use Illuminate\Http\Request;
2022-08-11 06:19:35 +02:00
class YodleeApiException extends Exception
{
/**
* Report the exception.
*
* @return void
*/
public function report()
{
//
}
/**
* Render the exception into an HTTP response.
*
* @param Request $request
2023-07-25 12:04:04 +02:00
* @return JsonResponse
2022-08-11 06:19:35 +02:00
*/
public function render($request)
{
// $msg = 'Unable to refund the transaction';
$msg = ctrans('texts.error');
2023-07-25 12:04:04 +02:00
if ($this->getMessage() && strlen($this->getMessage()) > 1) {
2022-08-11 06:19:35 +02:00
$msg = $this->getMessage();
}
return response()->json([
'message' => $msg,
], 400);
}
}