-
Notifications
You must be signed in to change notification settings - Fork 0
Catching Errors
Karen Coombs edited this page Jul 10, 2018
·
1 revision
- Open server.js
- Find the HTTP GET myaccount display route
- When a request doesn't return an ILLRequest, return the Error view. Pass it the following variables:
- error
- error_message
- error_detail
res.render('display-error', {error: error.getCode(), error_message: error.getMessage()});
- Create file views/display-error.html
<%- include('header.html') -%>
<h1>System Error</h1>
<div id="error_content">
<p id="status">Status - <%=error%></p>
<% if (error_message) { %>
<p id="message">Message - <%=error_message%></p>
<% }; %>
<% if (error_detail) { %>
<p id="detail"><%=error_detail%></p>
<% }; %>
</div>
<%- include('footer.html') -%>
- Open server.js
- In the getAccessToken function, add error template to the catch block
let error = new ILLRequestError(err);
res.render('display-error', {error: error.getCode(), error_message: error.getMessage(), error_detail: error.getDetail()});