Source: proto/spine/base/error_pb.js

  1. // source: spine/base/error.proto
  2. /**
  3. * @fileoverview
  4. * @enhanceable
  5. * @suppress {messageConventions} JS Compiler reports an error if a variable or
  6. * field starts with 'MSG_' and isn't a translatable message.
  7. * @public
  8. */
  9. // GENERATED CODE -- DO NOT EDIT!
  10. var jspb = require('google-protobuf');
  11. var goog = jspb;
  12. var global = Function('return this')();
  13. var spine_options_pb = require('../../spine/options_pb.js');
  14. goog.object.extend(proto, spine_options_pb);
  15. var google_protobuf_struct_pb = require('../../google/protobuf/struct_pb.js');
  16. goog.object.extend(proto, google_protobuf_struct_pb);
  17. var spine_validate_validation_error_pb = require('../../spine/validate/validation_error_pb.js');
  18. goog.object.extend(proto, spine_validate_validation_error_pb);
  19. goog.exportSymbol('proto.spine.base.Error', null, global);
  20. /**
  21. * Generated by JsPbCodeGenerator.
  22. * @param {Array=} opt_data Optional initial data array, typically from a
  23. * server response, or constructed directly in Javascript. The array is used
  24. * in place and becomes part of the constructed object. It is not cloned.
  25. * If no data is provided, the constructed object will be empty, but still
  26. * valid.
  27. * @extends {jspb.Message}
  28. * @constructor
  29. */
  30. proto.spine.base.Error = function(opt_data) {
  31. jspb.Message.initialize(this, opt_data, 0, -1, null, null);
  32. };
  33. goog.inherits(proto.spine.base.Error, jspb.Message);
  34. if (goog.DEBUG && !COMPILED) {
  35. /**
  36. * @public
  37. * @override
  38. */
  39. proto.spine.base.Error.displayName = 'proto.spine.base.Error';
  40. }
  41. if (jspb.Message.GENERATE_TO_OBJECT) {
  42. /**
  43. * Creates an object representation of this proto.
  44. * Field names that are reserved in JavaScript and will be renamed to pb_name.
  45. * Optional fields that are not set will be set to undefined.
  46. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
  47. * For the list of reserved names please see:
  48. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
  49. * @param {boolean=} opt_includeInstance Deprecated. whether to include the
  50. * JSPB instance for transitional soy proto support:
  51. * http://goto/soy-param-migration
  52. * @return {!Object}
  53. */
  54. proto.spine.base.Error.prototype.toObject = function(opt_includeInstance) {
  55. return proto.spine.base.Error.toObject(opt_includeInstance, this);
  56. };
  57. /**
  58. * Static version of the {@see toObject} method.
  59. * @param {boolean|undefined} includeInstance Deprecated. Whether to include
  60. * the JSPB instance for transitional soy proto support:
  61. * http://goto/soy-param-migration
  62. * @param {!proto.spine.base.Error} msg The msg instance to transform.
  63. * @return {!Object}
  64. * @suppress {unusedLocalVariables} f is only used for nested messages
  65. */
  66. proto.spine.base.Error.toObject = function(includeInstance, msg) {
  67. var f, obj = {
  68. type: jspb.Message.getFieldWithDefault(msg, 1, ""),
  69. code: jspb.Message.getFieldWithDefault(msg, 2, 0),
  70. validationError: (f = msg.getValidationError()) && spine_validate_validation_error_pb.ValidationError.toObject(includeInstance, f),
  71. message: jspb.Message.getFieldWithDefault(msg, 10, ""),
  72. attributesMap: (f = msg.getAttributesMap()) ? f.toObject(includeInstance, proto.google.protobuf.Value.toObject) : [],
  73. stacktrace: jspb.Message.getFieldWithDefault(msg, 12, "")
  74. };
  75. if (includeInstance) {
  76. obj.$jspbMessageInstance = msg;
  77. }
  78. return obj;
  79. };
  80. }
  81. /**
  82. * Deserializes binary data (in protobuf wire format).
  83. * @param {jspb.ByteSource} bytes The bytes to deserialize.
  84. * @return {!proto.spine.base.Error}
  85. */
  86. proto.spine.base.Error.deserializeBinary = function(bytes) {
  87. var reader = new jspb.BinaryReader(bytes);
  88. var msg = new proto.spine.base.Error;
  89. return proto.spine.base.Error.deserializeBinaryFromReader(msg, reader);
  90. };
  91. /**
  92. * Deserializes binary data (in protobuf wire format) from the
  93. * given reader into the given message object.
  94. * @param {!proto.spine.base.Error} msg The message object to deserialize into.
  95. * @param {!jspb.BinaryReader} reader The BinaryReader to use.
  96. * @return {!proto.spine.base.Error}
  97. */
  98. proto.spine.base.Error.deserializeBinaryFromReader = function(msg, reader) {
  99. while (reader.nextField()) {
  100. if (reader.isEndGroup()) {
  101. break;
  102. }
  103. var field = reader.getFieldNumber();
  104. switch (field) {
  105. case 1:
  106. var value = /** @type {string} */ (reader.readString());
  107. msg.setType(value);
  108. break;
  109. case 2:
  110. var value = /** @type {number} */ (reader.readInt32());
  111. msg.setCode(value);
  112. break;
  113. case 3:
  114. var value = new spine_validate_validation_error_pb.ValidationError;
  115. reader.readMessage(value,spine_validate_validation_error_pb.ValidationError.deserializeBinaryFromReader);
  116. msg.setValidationError(value);
  117. break;
  118. case 10:
  119. var value = /** @type {string} */ (reader.readString());
  120. msg.setMessage(value);
  121. break;
  122. case 11:
  123. var value = msg.getAttributesMap();
  124. reader.readMessage(value, function(message, reader) {
  125. jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.google.protobuf.Value.deserializeBinaryFromReader, "", new proto.google.protobuf.Value());
  126. });
  127. break;
  128. case 12:
  129. var value = /** @type {string} */ (reader.readString());
  130. msg.setStacktrace(value);
  131. break;
  132. default:
  133. reader.skipField();
  134. break;
  135. }
  136. }
  137. return msg;
  138. };
  139. /**
  140. * Serializes the message to binary data (in protobuf wire format).
  141. * @return {!Uint8Array}
  142. */
  143. proto.spine.base.Error.prototype.serializeBinary = function() {
  144. var writer = new jspb.BinaryWriter();
  145. proto.spine.base.Error.serializeBinaryToWriter(this, writer);
  146. return writer.getResultBuffer();
  147. };
  148. /**
  149. * Serializes the given message to binary data (in protobuf wire
  150. * format), writing to the given BinaryWriter.
  151. * @param {!proto.spine.base.Error} message
  152. * @param {!jspb.BinaryWriter} writer
  153. * @suppress {unusedLocalVariables} f is only used for nested messages
  154. */
  155. proto.spine.base.Error.serializeBinaryToWriter = function(message, writer) {
  156. var f = undefined;
  157. f = message.getType();
  158. if (f.length > 0) {
  159. writer.writeString(
  160. 1,
  161. f
  162. );
  163. }
  164. f = message.getCode();
  165. if (f !== 0) {
  166. writer.writeInt32(
  167. 2,
  168. f
  169. );
  170. }
  171. f = message.getValidationError();
  172. if (f != null) {
  173. writer.writeMessage(
  174. 3,
  175. f,
  176. spine_validate_validation_error_pb.ValidationError.serializeBinaryToWriter
  177. );
  178. }
  179. f = message.getMessage();
  180. if (f.length > 0) {
  181. writer.writeString(
  182. 10,
  183. f
  184. );
  185. }
  186. f = message.getAttributesMap(true);
  187. if (f && f.getLength() > 0) {
  188. f.serializeBinary(11, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.google.protobuf.Value.serializeBinaryToWriter);
  189. }
  190. f = message.getStacktrace();
  191. if (f.length > 0) {
  192. writer.writeString(
  193. 12,
  194. f
  195. );
  196. }
  197. };
  198. /**
  199. * optional string type = 1;
  200. * @return {string}
  201. */
  202. proto.spine.base.Error.prototype.getType = function() {
  203. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
  204. };
  205. /**
  206. * @param {string} value
  207. * @return {!proto.spine.base.Error} returns this
  208. */
  209. proto.spine.base.Error.prototype.setType = function(value) {
  210. return jspb.Message.setProto3StringField(this, 1, value);
  211. };
  212. /**
  213. * optional int32 code = 2;
  214. * @return {number}
  215. */
  216. proto.spine.base.Error.prototype.getCode = function() {
  217. return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
  218. };
  219. /**
  220. * @param {number} value
  221. * @return {!proto.spine.base.Error} returns this
  222. */
  223. proto.spine.base.Error.prototype.setCode = function(value) {
  224. return jspb.Message.setProto3IntField(this, 2, value);
  225. };
  226. /**
  227. * optional spine.validate.ValidationError validation_error = 3;
  228. * @return {?proto.spine.validate.ValidationError}
  229. */
  230. proto.spine.base.Error.prototype.getValidationError = function() {
  231. return /** @type{?proto.spine.validate.ValidationError} */ (
  232. jspb.Message.getWrapperField(this, spine_validate_validation_error_pb.ValidationError, 3));
  233. };
  234. /**
  235. * @param {?proto.spine.validate.ValidationError|undefined} value
  236. * @return {!proto.spine.base.Error} returns this
  237. */
  238. proto.spine.base.Error.prototype.setValidationError = function(value) {
  239. return jspb.Message.setWrapperField(this, 3, value);
  240. };
  241. /**
  242. * Clears the message field making it undefined.
  243. * @return {!proto.spine.base.Error} returns this
  244. */
  245. proto.spine.base.Error.prototype.clearValidationError = function() {
  246. return this.setValidationError(undefined);
  247. };
  248. /**
  249. * Returns whether this field is set.
  250. * @return {boolean}
  251. */
  252. proto.spine.base.Error.prototype.hasValidationError = function() {
  253. return jspb.Message.getField(this, 3) != null;
  254. };
  255. /**
  256. * optional string message = 10;
  257. * @return {string}
  258. */
  259. proto.spine.base.Error.prototype.getMessage = function() {
  260. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, ""));
  261. };
  262. /**
  263. * @param {string} value
  264. * @return {!proto.spine.base.Error} returns this
  265. */
  266. proto.spine.base.Error.prototype.setMessage = function(value) {
  267. return jspb.Message.setProto3StringField(this, 10, value);
  268. };
  269. /**
  270. * map<string, google.protobuf.Value> attributes = 11;
  271. * @param {boolean=} opt_noLazyCreate Do not create the map if
  272. * empty, instead returning `undefined`
  273. * @return {!jspb.Map<string,!proto.google.protobuf.Value>}
  274. */
  275. proto.spine.base.Error.prototype.getAttributesMap = function(opt_noLazyCreate) {
  276. return /** @type {!jspb.Map<string,!proto.google.protobuf.Value>} */ (
  277. jspb.Message.getMapField(this, 11, opt_noLazyCreate,
  278. proto.google.protobuf.Value));
  279. };
  280. /**
  281. * Clears values from the map. The map will be non-null.
  282. * @return {!proto.spine.base.Error} returns this
  283. */
  284. proto.spine.base.Error.prototype.clearAttributesMap = function() {
  285. this.getAttributesMap().clear();
  286. return this;};
  287. /**
  288. * optional string stacktrace = 12;
  289. * @return {string}
  290. */
  291. proto.spine.base.Error.prototype.getStacktrace = function() {
  292. return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, ""));
  293. };
  294. /**
  295. * @param {string} value
  296. * @return {!proto.spine.base.Error} returns this
  297. */
  298. proto.spine.base.Error.prototype.setStacktrace = function(value) {
  299. return jspb.Message.setProto3StringField(this, 12, value);
  300. };
  301. goog.object.extend(exports, proto.spine.base);
  302. // Generated by Spine ProtoJs Plugin
  303. let ObjectParser = require('../../../client/parser/object-parser.js').default;
  304. let TypeParsers = require('../../../client/parser/type-parsers.js').default;
  305. proto.spine.base.Error.Parser = function() {
  306. ObjectParser.call(this);
  307. };
  308. proto.spine.base.Error.Parser.prototype = Object.create(ObjectParser.prototype);
  309. proto.spine.base.Error.Parser.prototype.constructor = proto.spine.base.Error.Parser;
  310. proto.spine.base.Error.Parser.prototype.fromObject = function(obj) {
  311. if (obj === null) {
  312. return null;
  313. }
  314. let msg = new proto.spine.base.Error();
  315. if (obj.type !== undefined) {
  316. if (obj.type !== null) {
  317. let value = obj.type;
  318. msg.setType(value);
  319. }
  320. }
  321. if (obj.code !== undefined) {
  322. if (obj.code !== null) {
  323. let value = obj.code;
  324. msg.setCode(value);
  325. }
  326. }
  327. if (obj.validationError !== undefined) {
  328. if (obj.validationError === null) {
  329. msg.setValidationError(null);
  330. } else {
  331. let value = TypeParsers.parserFor('type.spine.io/spine.validate.ValidationError').fromObject(obj.validationError);
  332. msg.setValidationError(value);
  333. }
  334. }
  335. if (obj.message !== undefined) {
  336. if (obj.message !== null) {
  337. let value = obj.message;
  338. msg.setMessage(value);
  339. }
  340. }
  341. if (obj.attributes !== undefined && obj.attributes !== null) {
  342. for (let attribute in obj.attributes) {
  343. if (obj.attributes.hasOwnProperty(attribute)) {
  344. let mapKey = attribute;
  345. let value = TypeParsers.parserFor('type.googleapis.com/google.protobuf.Value').fromObject(obj.attributes[attribute]);
  346. msg.getAttributesMap().set(mapKey, value);
  347. }
  348. }
  349. }
  350. if (obj.stacktrace !== undefined) {
  351. if (obj.stacktrace !== null) {
  352. let value = obj.stacktrace;
  353. msg.setStacktrace(value);
  354. }
  355. }
  356. return msg;
  357. };
  358. // Generated by Spine ProtoJs Plugin
  359. proto.spine.base.Error.typeUrl = function() {
  360. return 'type.spine.io/spine.base.Error';
  361. };