Is it possible to log errors happening in custom application? | The place for Zendesk users to come together and share
Skip to main content
Question

Is it possible to log errors happening in custom application?

  • March 17, 2022
  • 5 replies
  • 0 views

Vladyslav12

I have custom application on the ticket page. It makes call on external api and shows some information. But i want to log errors that happen during that call. Is there any instruments in zendesk for doing this?

5 replies

Tipene
  • Employee
  • March 18, 2022

Hi @vladyslav12,

Thanks for reaching out!

When making calls to external APIs with the client.request method, a response object is returned which contains properties you can access to display certain information. For example, you could console.log(response.responseText) to log any errors resulting from a failed API call. Here's a link to the documentation that goes in to a bit more detail: 

I hope this helps! Let me know if you have any questions.

Tipene


Vladyslav12
  • Author
  • March 21, 2022

I believe that console.log is not the best idea to log errors.  Is there any other way to do that?


Tipene
  • Employee
  • March 21, 2022

Hi @vladyslav12,

You can manipulate the data returned in the response object in whichever way you need - it doesn't need to be a console log. If you want to let me know what your use case, I'll be happy to point you in the right direction.

Tipene


Vladyslav12
  • Author
  • March 23, 2022

I dont want agents see errors in app window or console. But me as admin want to have oportunity to see logs with details (e.g. in Admin Center) in case of errors. Is there any opportunity for doing that? 


Tipene
  • Employee
  • March 24, 2022
There isn't a location within the UI of your Zendesk instance where you'll be able to display errors generated by an app. By default, error messages will be displayed in the console as part of any error response from the API endpoint. One work around for this could be to override the default behavior of the console messages, for example:
 
if (env === production){
   console = function() {}
}
 
Then, you could use something like Node.js to write an error handler that adds the errors to a .txt file.