Recent searches


No recent searches

Is it possible to log errors happening in custom application?



Posted Mar 17, 2022

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?


0

5

5 comments

image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Vladyslav Filonov,

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

0


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

0


image avatar

Tipene Hughes

Zendesk Developer Advocacy

Hi Vladyslav Filonov,

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

0


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? 

0


image avatar

Tipene Hughes

Zendesk Developer Advocacy

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. 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post