001/* 002 * Copyright (C) 2016 Hobrasoft s.r.o. 003 * 004 * This program is free software: you can redistribute it and/or modify 005 * it under the terms of the GNU Affero General Public License as published by 006 * the Free Software Foundation, either version 3 of the License, or 007 * (at your option) any later version. 008 * 009 * This program is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 * GNU Affero General Public License for more details. 013 * 014 * You should have received a copy of the GNU Affero General Public License 015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 016 */ 017package cz.hobrasoft.pdfmu.jackson; 018 019import com.fasterxml.jackson.annotation.JsonInclude; 020import com.fasterxml.jackson.annotation.JsonInclude.Include; 021import com.fasterxml.jackson.annotation.JsonProperty; 022import com.fasterxml.jackson.annotation.JsonPropertyDescription; 023import java.util.Map; 024 025/** 026 * 027 * @author <a href="mailto:filip.bartek@hobrasoft.cz">Filip Bartek</a> 028 */ 029public class RpcError { 030 031 @JsonPropertyDescription("A Number that indicates the error type that occurred.") 032 @JsonProperty(required = true) 033 public int code; 034 035 @JsonPropertyDescription("A String providing a short description of the error.\n" 036 + "The message SHOULD be limited to a concise single sentence.") 037 @JsonProperty(required = true) 038 public String message; 039 040 public static class Data { 041 042 @JsonInclude(Include.NON_NULL) 043 public Class causeClass; 044 045 @JsonInclude(Include.NON_NULL) 046 public String causeMessage; 047 048 @JsonInclude(Include.NON_NULL) 049 public Map<String, Object> arguments; 050 } 051 052 @JsonPropertyDescription("A Primitive or Structured value that contains additional information about the error.\n" 053 + "This may be omitted.\n" 054 + "The value of this member is defined by the Server (e.g. detailed error information, nested errors etc.).") 055 @JsonInclude(Include.NON_NULL) 056 public Data data; 057 058 public RpcError(int code, String message) { 059 this.code = code; 060 this.message = message; 061 } 062}