Skip to content

Commit 7f41492

Browse files
committed
fix: expose Api exception, detailed response and iam token modules
1 parent 6aaf3c5 commit 7f41492

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lib/ibm_watson.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# frozen_string_literal: true
22

3+
require("ibm_cloud_sdk_core")
4+
35
# Module for the Watson APIs
46
module IBMWatson
7+
ApiException = IBMCloudSdkCore::ApiException
8+
DetailedResponse = IBMCloudSdkCore::DetailedResponse
9+
IAMTokenManager = IBMCloudSdkCore::IAMTokenManager
10+
511
require_relative("./ibm_watson/personality_insights_v3.rb")
612
require_relative("./ibm_watson/tone_analyzer_v3.rb")
713
require_relative("./ibm_watson/assistant_v1.rb")

test/integration/test_iam_assistant_v1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def test_receive_error
706706
begin
707707
service.iam_apikey(iam_apikey: "bogus_api_key")
708708
service.list_workspaces
709-
rescue IBMCloudSdkCore::ApiException => e
709+
rescue IBMWatson::ApiException => e
710710
assert_equal("Provided API key could not be found", e.info["errorMessage"])
711711
error_received = true
712712
end

test/unit/test_assistant_v1.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_rate_limit_exceeded
101101
workspace_id: "boguswid",
102102
text: "I want financial advice today."
103103
)
104-
rescue IBMCloudSdkCore::ApiException => e
104+
rescue IBMWatson::ApiException => e
105105
assert_equal(error_code, e.code)
106106
assert_equal(error_msg, e.error)
107107
assert(e.to_s.instance_of?(String))
@@ -138,7 +138,7 @@ def test_unknown_error
138138
workspace_id: "boguswid",
139139
text: "I want financial advice today."
140140
)
141-
rescue IBMCloudSdkCore::ApiException => e
141+
rescue IBMWatson::ApiException => e
142142
assert_equal(error_code, e.code)
143143
assert_equal(error_msg, e.error)
144144
end

test/unit/test_tone_analyzer_v3.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_error
135135
)
136136
begin
137137
service.tone(tone_input: text, content_type: "application/json")
138-
rescue IBMCloudSdkCore::ApiException => e
138+
rescue IBMWatson::ApiException => e
139139
assert_equal(error_code, e.code)
140140
assert_equal(error_message, e.error)
141141
assert_equal("C00012", e.info["sub_code"])

0 commit comments

Comments
 (0)