Sha256: a8e1f0b0b1dc69357b423d7e3b366e55b5d693c67ff493fde415f8d8bebd4213

Contents?: true

Size: 848 Bytes

Versions: 6

Compression:

Stored size: 848 Bytes

Contents

const AbstractHandler = require("./AbstractHandler");

class GetTypeHandler extends AbstractHandler {
    constructor() {
        super()
    }

    requiredParametersCount = 1

    process(command) {
        try {
            if (command.payload.length < this.requiredParametersCount) {
                throw new Error("Get Type parameters mismatch")
            }
            const {payload} = command
            let typeName = payload[0]
            typeName = typeName.replace(".js", "")
            let type = global[typeName]
            if (type == undefined) {
                throw new Error(`Cannot load ${typeName}`)
            } else {
                return type
            }
        } catch (error) {
            throw this.process_stack_trace(error, this.constructor.name)
        }

    }
}

module.exports = new GetTypeHandler()

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.10 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.9 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Nodejs/Linux/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.8 lib/javonet-ruby-sdk/Binaries/Nodejs/MacOs/X64/core/handler/GetTypeHandler.js