Sha256: 5bc1ff6c5f09fd4363fe1531b4d541a3b47e0a87d2ef67cd42c5ead994737b58
Contents?: true
Size: 1011 Bytes
Versions: 11
Compression:
Stored size: 1011 Bytes
Contents
const AbstractHandler = require("./AbstractHandler"); class GetStaticFieldHandler extends AbstractHandler { requiredParametersCount = 2; constructor() { super(); } process(command) { try { if (command.payload.length < this.requiredParametersCount) { throw new Error("Array Static Field parameters mismatch"); } const { payload } = command; let type = payload[0]; let field = payload[1]; let staticField = type[field]; if (typeof staticField === "undefined") { let fields = Object.keys(type); let message = `Field ${field} not found in class. Available fields:\n`; fields.forEach((fieldIter) => { message += `${fieldIter}\n`; }); throw new Error(message); } else { return staticField; } } catch (error) { throw this.process_stack_trace(error, this.constructor.name); } } } module.exports = new GetStaticFieldHandler();
Version data entries
11 entries across 11 versions & 1 rubygems