handle static method

Exception handle(
  1. int? statusCode
)

Implementation

static Exception handle(int? statusCode) {
  switch (statusCode) {
    case 401:
      return UnauthorizedException();
    case 500:
      return ServerErrorException();
    default:
      return SomethingWentWrongException();
  }
}