internalServerError method
use data
=> if you want to add more details to the client side use it
use exception
=> if you want to display the exception BUT
! it will be sent to client side in debug mode only
Implementation
Future<void> internalServerError({
Object? data,
Object? exception,
}) async {
await json(
{
'status_code': io.HttpStatus.internalServerError,
'message': 'Internal Server Error',
if (data != null) 'data': data,
if (exception != null) 'exception': exception
// if (exception != null && !isInProduction) 'exception': exception
},
statusCode: io.HttpStatus.internalServerError,
);
}