{-# LANGUAGE OverloadedStrings, GADTSyntax #-}moduleNetwork.Api.Postmark.ErrorwhereimportControl.ApplicativeimportData.AesonimportData.Text-- * Error typesdataPostmarkError=PostmarkError{errorType::PostmarkErrorType,errorMessage::Text}deriving(Eq,Show)dataPostmarkErrorType=PostmarkBadApiToken|PostmarkInvalidEmail|PostmarkSenderNotFound|PostmarkSenderNotConfirmed|PostmarkInvalidJson|PostmarkIncompatibleJson|PostmarkNotAllowed|PostmarkInactive|PostmarkBounceNotFound|PostmarkBounceQueryException|PostmarkJsonRequired|PostmarkTooManyMessages|PostmarkUnkownErrorIntderivingEqinstanceFromJSONPostmarkErrorwhereparseJSON(Objecto)=PostmarkError<$>(fmap(\code->casecodeof0->PostmarkBadApiToken300->PostmarkInvalidEmail400->PostmarkSenderNotFound401->PostmarkSenderNotConfirmed402->PostmarkInvalidJson403->PostmarkIncompatibleJson405->PostmarkNotAllowed406->PostmarkInactive407->PostmarkBounceNotFound408->PostmarkBounceQueryException409->PostmarkJsonRequired410->PostmarkTooManyMessages_->PostmarkUnkownErrorcode)(o.:"ErrorCode"))<*>(o.:"Message")parseJSON_=fail"Invalid Postmark Error Response"instanceShowPostmarkErrorTypewhereshowPostmarkBadApiToken="Your request did not submit the correct API token in the X-Postmark-Server-Token header."showPostmarkInvalidEmail="Validation failed for the email request JSON data that you provided."showPostmarkSenderNotFound="You are trying to send email with a From address that does not have a sender signature."showPostmarkSenderNotConfirmed="You are trying to send email with a From address that does not have a corresponding confirmed sender signature."showPostmarkInvalidJson="The JSON input you provided is syntactically incorrect."showPostmarkIncompatibleJson="The JSON input you provided is syntactically correct, but still not the one we expect."showPostmarkNotAllowed="You ran out of credits."showPostmarkInactive="You tried to send to a recipient that has been marked as inactive. Inactive recipients are ones that have generated a hard bounce or a spam complaint."showPostmarkBounceNotFound="You requested a bounce by ID, but we could not find an entry in our database."showPostmarkBounceQueryException="You provided bad arguments as a bounces filter."showPostmarkJsonRequired="Your HTTP request does not have the Accept and Content-Type headers set to application/json."showPostmarkTooManyMessages="Your batched request contains more than 500 messages."show(PostmarkUnkownErrorcode)="An unexpected error code ["++showcode++"] was retured from postmark."