gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[reclaim-oidc] 16/18: added error handling for unknown commands + REST s


From: gnunet
Subject: [reclaim-oidc] 16/18: added error handling for unknown commands + REST service not running
Date: Sat, 12 Jun 2021 00:40:52 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository reclaim-oidc.

commit 0e475c526c942c77ef34acd535ff7cbf173cadca
Author: Alexia Pagkopoulou <a.pagkopoulou@tum.de>
AuthorDate: Wed Aug 21 15:28:56 2019 +0200

    added error handling for unknown commands + REST service not running
---
 bin/reclaim-oidc    | 10 +++++++---
 lib/reclaim_oidc.rb |  9 +++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/bin/reclaim-oidc b/bin/reclaim-oidc
index 749c7e9..878f43f 100755
--- a/bin/reclaim-oidc
+++ b/bin/reclaim-oidc
@@ -89,13 +89,13 @@ class OptParser
         self.verbose = v
       end
     end
-  
+    
     def jwt_secret_option(parser)
       parser.on("-j", "--jwt-secret [JWT-SECRET]", "Set JWT secret") do |v|
         self.jwt_secret = v
       end
     end
-  end  
+  end
 
   #
   # Return a structure describing the options.
@@ -107,7 +107,11 @@ class OptParser
     @options = ScriptOptions.new
     @args = OptionParser.new do |parser|
       @options.define_options(parser)
-      parser.parse!(args)
+      begin
+        parser.parse!(args)
+      rescue OptionParser::InvalidOption => e
+        puts "ERROR: Invalid option"
+      end
     end
     @options
   end
diff --git a/lib/reclaim_oidc.rb b/lib/reclaim_oidc.rb
index fa91c05..4c06936 100644
--- a/lib/reclaim_oidc.rb
+++ b/lib/reclaim_oidc.rb
@@ -26,8 +26,13 @@ class ReclaimOidc
 
   def get_client_secret
     uri = URI(@url + '/config/reclaim-rest-plugin')
-    resp = JSON.parse Net::HTTP.get(uri)
-    return resp["OIDC_CLIENT_SECRET"]
+    begin
+      resp = JSON.parse Net::HTTP.get(uri)
+      return resp["OIDC_CLIENT_SECRET"]
+    rescue Errno::ECONNREFUSED => e
+      puts "ERROR: REST service is not running"
+      exit
+    end
   end
 
   def get_clients

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]