Controlling the error message when a document is corrupt

Currently if the Groupdocs viewer is handed a stream to a corrupt document an ASP.Net exception is produced indicating a Server Error in our application with a message saying the document is corrupt and including a stack trace.



The error is accurate, but we’d like to be able to handle it in a friendlier way showing a less scary message to the end user. As far as I can tell the stack trace doesn’t have any of our code on it, so I don’t know of a way to trap the error.



Do you have any suggestions?



Thanks,

Don

Hello Dwaldo,

Thank you for your request. Yes, managing the error handling is possible. To create your own error handler you can use JavaScript events from GroupDocs.Viewer widget. For how to do that please check paragraph three from this article -http://groupdocs.com/docs/display/viewernet/Description+of+Groupdocs+Viewer+JavaScript+widget+events



If I am using the GroupDocs Viewer for Java, is there a way I can edit the error message too? The wiki seems to specifically address the .NET library

Yes, sure. These same methods work nice in the GroupDocs.Viewer for Java library too (http://groupdocs.com/docs/display/viewerjava/GroupDocs.Viewer+for+Java±+Triggers+Customization), the front-end is the same.