genericError static method
ErrorDetail
genericError(
- ErrorDetail? errorDetail
A generic method to parse a GenericError
. The following is achieved on the object:
- Set type as
GenericError
by default if not already set - Set title as 'Generic Error` by default if not already set
Implementation
static ErrorDetail genericError(ErrorDetail? errorDetail) {
if (errorDetail == null) {
return ErrorDetail(
title: RenovationController.GENERIC_ERROR_TITLE,
type: RenovationError.GenericError,
info: Information(httpCode: 400));
}
return errorDetail
..title = errorDetail.title ?? RenovationController.GENERIC_ERROR_TITLE
..type = errorDetail.type ?? RenovationError.GenericError
..info = errorDetail.info != null
? (errorDetail.info!..httpCode = errorDetail.info?.httpCode ?? 400)
: Information(httpCode: 400);
}