Sha256: 9328752871d60c99f7c6c01a303f85435c22e91c854dd750f38b4672d5023df9
Contents?: true
Size: 975 Bytes
Versions: 31
Compression:
Stored size: 975 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
31 entries across 20 versions & 1 rubygems