Class PushError
java.lang.Object
java.lang.Throwable
java.lang.Exception
com.iizix.server.push.engine.http.PushError
- All Implemented Interfaces:
Serializable
A refused request: the HTTP status, the
error code from the closed vocabulary of PushWire.ERRORS and the human message, plus any extra members the reply carries (a 409 carries vapid_reason and fcm_reason).Every failure the handler answers is one of these, so the reply shape of PUSH-WIRE-CONTRACT.md section 1.2 is built in one place, toJSON().
- Author:
- Christopher Mindus
- See Also:
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringTheerrorcode, one ofPushWire.ERRORS.final intThe HTTP status.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic PushErrorbadRequest(String message) A 400bad_request.static PushErrorA 403forbidden.toJSON()Builds the reply body:{ok:false, error, message}plus the extra members.static PushErrorunauthenticated(String message) A 401unauthenticated.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Field Details
status
public final int statusThe HTTP status.code
Theerrorcode, one ofPushWire.ERRORS.
Constructor Details
PushError
Constructor.- Parameters:
status- The HTTP status.code- The error code, one ofPushWire.ERRORS.message- The human text, English, never localised, never a stack trace.
PushError
Constructor with extra reply members.- Parameters:
status- The HTTP status.code- The error code, one ofPushWire.ERRORS.message- The human text.extra- Extra members of the reply, null for none.
Method Details
badRequest
unauthenticated
forbidden
toJSON
Builds the reply body:{ok:false, error, message}plus the extra members.- Returns:
- A new JSON object.