lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Javonet.pm in javonet-ruby-sdk-2.4.6 vs lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/lib/Javonet/Javonet.pm in javonet-ruby-sdk-2.4.7
- old
+ new
@@ -1,48 +1,71 @@
package Javonet::Javonet;
use strict;
use warnings FATAL => 'all';
use Moose;
use lib 'lib';
+use Try::Tiny;
+use threads;
use aliased 'Javonet::Sdk::Internal::RuntimeFactory' => 'RuntimeFactory';
use aliased 'Javonet::Core::Transmitter::PerlTransmitter' => 'Transmitter', qw(activate_with_license_file activate_with_credentials activate_with_credentials_and_proxy);
+use aliased 'Javonet::Core::Exception::SdkExceptionHelper' => 'SdkExceptionHelper';
BEGIN {
- Transmitter->activate_with_license_file()
+ try {
+ Transmitter->activate_with_license_file();
+ } catch {
+ SdkExceptionHelper->send_exception_to_app_insights($_,"JavonetStatic");
+ };
}
sub activate {
if(@_ == 1) {
- return Transmitter->activate_with_license_file();
+ try {
+ return Transmitter->activate_with_license_file();
+ } catch {
+ Javonet::Core::Exception::SdkExceptionHelper->send_exception_to_app_insights($_,"licenseFile");
+ die($_);
+ };
}
if(@_ == 2) {
my($self, $licenseKey) = @_;
- return Transmitter->activate_with_credentials($licenseKey);
+ try {
+ return Transmitter->activate_with_credentials($licenseKey);
+ } catch {
+ Javonet::Core::Exception::SdkExceptionHelper->send_exception_to_app_insights($_,$licenseKey);
+ die($_);
+ };
} elsif (@_ > 2) {
my($self, $licenseKey, $proxyHost, $proxyUserName, $proxyPassword) = @_;
$proxyUserName //="";
$proxyPassword //="";
- return Transmitter->activate_with_credentials_and_proxy($licenseKey, $proxyHost, $proxyUserName, $proxyPassword);
+ try {
+ return Transmitter->activate_with_credentials_and_proxy($licenseKey, $proxyHost, $proxyUserName, $proxyPassword);
+ } catch {
+ Javonet::Core::Exception::SdkExceptionHelper->send_exception_to_app_insights($_,$licenseKey);
+ die($_);
+ };
}
-
}
sub in_memory {
return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('InMemory'), undef, undef);
}
sub tcp {
- # additional shift is needed to pass second argument
my $class = shift;
my $address = shift;
return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('Tcp'), $address, undef);
}
sub with_config {
my ($self, $config_path) = @_;
- # Sets the configuration source
- Transmitter->set_config_source($config_path);
- # Returns a new RuntimeFactory instance configured with a custom configuration file
- return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('WithConfig'), undef, $config_path);
+ try {
+ Transmitter->set_config_source($config_path);
+ return RuntimeFactory->new(Javonet::Sdk::Internal::ConnectionType::get_connection_type('WithConfig'), undef, $config_path);
+ } catch {
+ SdkExceptionHelper->send_exception_to_app_insights($_,"withConfig");
+ die $_;
+ };
}
1;
\ No newline at end of file