MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / formatNotFoundV1

Method formatNotFoundV1

src/tsd/HttpSerializer.java:822–842  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 2

notFoundMethod · 0.80
sendFileMethod · 0.80

Calls 7

apiVersionMethod · 0.80
getCharsetMethod · 0.80
hasQueryStringParamMethod · 0.45
appendMethod · 0.45
getQueryStringParamMethod · 0.45
getBytesMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected