Formats a 404 error when an endpoint or file wasn't found WARNING: If overriding, make sure this method catches all errors and returns a byte array with a simple string error at the minimum @return A standard JSON error
()
| 820 | * @return A standard JSON error |
| 821 | */ |
| 822 | public ChannelBuffer formatNotFoundV1() { |
| 823 | StringBuilder output = |
| 824 | new StringBuilder(1024); |
| 825 | if (query.hasQueryStringParam("jsonp")) { |
| 826 | output.append(query.getQueryStringParam("jsonp") + "("); |
| 827 | } |
| 828 | output.append("{\"error\":{\"code\":"); |
| 829 | output.append(404); |
| 830 | output.append(",\"message\":\""); |
| 831 | if (query.apiVersion() > 0) { |
| 832 | output.append("Endpoint not found"); |
| 833 | } else { |
| 834 | output.append("Page not found"); |
| 835 | } |
| 836 | output.append("\"}}"); |
| 837 | if (query.hasQueryStringParam("jsonp")) { |
| 838 | output.append(")"); |
| 839 | } |
| 840 | return ChannelBuffers.copiedBuffer( |
| 841 | output.toString().getBytes(this.query.getCharset())); |
| 842 | } |
| 843 | |
| 844 | /** |
| 845 | * Format a bad request exception, indicating an invalid request from the |
no test coverage detected