Sha256: 9591007fad1cfc2089c23f290f4bdbcdd775808e65338fda0a5088cf2fab6754

Contents?: true

Size: 1.3 KB

Versions: 16

Compression:

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

16 entries across 8 versions & 1 rubygems

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