Sha256: 3aac32c781e67a2acde0e67b142a4d7f3f806b18bddcf800be2b4720bf9c0856

Contents?: true

Size: 1.34 KB

Versions: 8

Compression:

Stored size: 1.34 KB

Contents

package Javonet::Core::Exception::ExceptionThrower;
use strict;
use warnings FATAL => 'all';
use Moose;
use Nice::Try;
use aliased 'Javonet::Core::Exception::Exception' => 'Exception';
use lib 'lib';


sub throwException {
    my ($self, $exception_command) = @_;
    my $exception_name = $exception_command->{payload}[2];
    my $exception_message =$exception_name . "\n " . $exception_command->{payload}[3];
    my $stack_trace = "";
    if (defined($exception_command->{payload}[4])){
        $stack_trace = create_stack_trace($exception_command->{payload}[4], $exception_command->{payload}[5], $exception_command->{payload}[6], $exception_command->{payload}[7]);
    }

    die $exception_name . " \n " . $exception_message . " \n " .$stack_trace;
}

sub create_stack_trace {
    my ($stack_trace_classes, $stack_trace_methods, $stack_trace_lines, $stack_trace_files) = @_;
    my @classes = split /\|/, $stack_trace_classes;
    my @methods = split /\|/, $stack_trace_methods;
    my @lines = split /\|/, $stack_trace_lines;
    my @files = split /\|/, $stack_trace_files;

    my $stack_trace = "";
    for (my $i = 0; $i < scalar(@classes); $i++) {
        $stack_trace .= "  at $methods[$i] ";
        $stack_trace .= "($files[$i] line $lines[$i])";
        $stack_trace .= "\n";
    }

    return $stack_trace;
}

no Moose;
1;

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.4.5 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.4.4 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.4.3 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.4.2 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.3.0 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm
javonet-ruby-sdk-2.2.0 lib/javonet-ruby-sdk/Binaries/Perl/Windows/X64/lib/Javonet/Core/Exception/ExceptionThrower.pm