Sha256: 529b8688e675c4596d6f30663fdd853e124b933ba621d75052ec6b45a28a88d1

Contents?: true

Size: 879 Bytes

Versions: 9

Compression:

Stored size: 879 Bytes

Contents

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

class GetTypeHandler extends AbstractHandler {
    requiredParametersCount = 1

    constructor() {
        super()
    }

    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

9 entries across 9 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.5 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.4.4 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.3.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.2.0 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.14 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.13 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js
javonet-ruby-sdk-2.1.12 lib/javonet-ruby-sdk/Binaries/Nodejs/Windows/X64/core/handler/GetTypeHandler.js