handleError method

  1. @override
ErrorDetail handleError(
  1. String errorId,
  2. ErrorDetail? error
)

Returns the ErrorDetail after manipulating an existing one.

Method that handles errors by parsing the raw response or custom input.

If other errors are to be added, then they will be handled here as if-else or switch-case.

Each error needs to be supplied an errorId, or null if a Generic Error were to be returned.

If error is passed, it can be manipulated within this method and return the modified ErrorDetail object.

Implementation

@override
ErrorDetail handleError(String errorId, ErrorDetail? error) {
  ErrorDetail err;
  switch (errorId) {
    case 'loadtranslation':
    default:
      err = RenovationController.genericError(error!);
  }
  return err;
}