MCPcopy Create free account
hub / github.com/amadeus4dev/amadeus-java / detectError

Method detectError

src/main/java/com/amadeus/Response.java:69–89  ·  view source on GitHub ↗
(HTTPClient client)

Source from the content-addressed store, hash-verified

67
68 // Detects of any exceptions have occured and throws the appropriate exceptions.
69 protected void detectError(HTTPClient client) throws ResponseException {
70 ResponseException exception = null;
71 if (statusCode >= 500) {
72 exception = new ServerException(this);
73 } else if (statusCode == 404) {
74 exception = new NotFoundException(this);
75 } else if (statusCode == 401) {
76 exception = new AuthenticationException(this);
77 } else if (statusCode >= 400) {
78 exception = new ClientException(this);
79 } else if (statusCode == 204) {
80 return;
81 } else if (!parsed) {
82 exception = new ParserException(this);
83 }
84
85 if (exception != null) {
86 exception.log(client.getConfiguration());
87 throw exception;
88 }
89 }
90
91 // Tries to parse the status code. Catches any exceptions and defaults to
92 // status 0 if an error occurred.

Callers 8

executeMethod · 0.95
detectServerExceptionMethod · 0.80
detectClientExceptionMethod · 0.80
detectParserExceptionMethod · 0.80
detectNoExceptionMethod · 0.80

Calls 1

logMethod · 0.95

Tested by 7

detectServerExceptionMethod · 0.64
detectClientExceptionMethod · 0.64
detectParserExceptionMethod · 0.64
detectNoExceptionMethod · 0.64