|
|||
Handle ExceptionsYou may find errors in the errors field that contains a line number, a common message, and detailed messages. If an error is critical, the errors field contains only one error message. You can investigate errors the following way: try { client = MonitoringServiceClient.defaultConfig(); client.send().logs("my custom source", new LogRecord()); } catch(ClientConfigurationException configError) { // Occurs during client building. Make sure your client configuration is valid. } catch(ErrorResponseException httpError) { // Occurs when an HTTP request is executed normally, but the status code is different from 2xx. An error contains a body and a status code. } catch(CommonIOException ioError) { // IO exception that occurs during the request execution or reading a response. Make sure your network connection is active. } catch(ClientAuthException authError) { // An authentication error. Make sure your Smart Trading account credentials are valid and you have the required access to the Cloud Monitoring service. } catch(GenericClientException anyError) { // All the errors mentioned above. } |