Sha256: f64e009f98aea3cce92fc55c74cc1a616e88e1fe624de8c398981e6522dc942e

Contents?: true

Size: 849 Bytes

Versions: 18

Compression:

Stored size: 849 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

18 entries across 9 versions & 1 rubygems

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