MCPcopy Create free account
hub / github.com/Asana/java-asana / mapException

Method mapException

src/main/java/com/asana/errors/AsanaError.java:21–42  ·  view source on GitHub ↗
(HttpResponseException exception)

Source from the content-addressed store, hash-verified

19 }
20
21 public static AsanaError mapException(HttpResponseException exception) throws AsanaError {
22 switch (exception.getStatusCode()) {
23 case ForbiddenError.STATUS:
24 return new ForbiddenError(exception);
25 case InvalidRequestError.STATUS:
26 return new InvalidRequestError(exception);
27 case InvalidTokenError.STATUS:
28 return new InvalidTokenError(exception);
29 case NoAuthorizationError.STATUS:
30 return new NoAuthorizationError(exception);
31 case NotFoundError.STATUS:
32 return new NotFoundError(exception);
33 case PremiumOnlyError.STATUS:
34 return new PremiumOnlyError(exception);
35 case RateLimitEnforcedError.STATUS:
36 return new RateLimitEnforcedError(exception);
37 case ServerError.STATUS:
38 return new ServerError(exception);
39 default:
40 return new AsanaError(exception.getStatusMessage(), exception.getStatusCode(), exception);
41 }
42 }
43
44 private static String constructMessage(String message, HttpResponseException exception) {
45 try {

Callers 1

requestMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected