Skip to content

Commit 079ae65

Browse files
committed
Catch StandardError, not Exception, as JsonLdError was changed.
Make Framing errors a subclass of JsonLdErrors.
1 parent e6b941b commit 079ae65

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/json/ld.rb

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,10 @@ class LoadingDocumentFailed < JsonLdError; @code = "loading document failed"; en
131131
class LoadingRemoteContextFailed < JsonLdError; @code = "loading remote context failed"; end
132132
class MultipleContextLinkHeaders < JsonLdError; @code = "multiple context link headers"; end
133133
class RecursiveContextInclusion < JsonLdError; @code = "recursive context inclusion"; end
134-
end
135-
136-
class InvalidFrame < Exception
137-
class MultipleEmbeds < InvalidFrame; end
138-
class Syntax < InvalidFrame; end
134+
class InvalidFrame < JsonLdError
135+
class MultipleEmbeds < InvalidFrame; end
136+
class Syntax < InvalidFrame; end
137+
end
139138
end
140139
end
141140
end

lib/json/ld/context.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,12 @@ def parse(local_context, remote_contexts = [])
396396
end
397397
rescue JsonLdError::LoadingDocumentFailed => e
398398
#log_debug("parse") {"Failed to retrieve @context from remote document at #{context_no_base.context_base.inspect}: #{e.message}"}
399-
raise JsonLdError::LoadingRemoteContextFailed, "#{context_no_base.context_base}", e.backtrace
399+
raise JsonLdError::LoadingRemoteContextFailed, "#{context_no_base.context_base}: #{e.message}", e.backtrace
400400
rescue JsonLdError
401401
raise
402-
rescue Exception => e
402+
rescue StandardError => e
403403
#log_debug("parse") {"Failed to retrieve @context from remote document at #{context_no_base.context_base.inspect}: #{e.message}"}
404-
raise JsonLdError::LoadingRemoteContextFailed, "#{context_no_base.context_base}", e.backtrace
404+
raise JsonLdError::LoadingRemoteContextFailed, "#{context_no_base.context_base}: #{e.message}", e.backtrace
405405
end
406406

407407
# 3.2.6) Set context to the result of recursively calling this algorithm, passing context no base for active context, context for local context, and remote contexts.

script/tc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def run_tc(man, tc, options)
9494
rescue Interrupt
9595
$stderr.puts "(interrupt)"
9696
exit 1
97-
rescue Exception => e
97+
rescue StandardError => e
9898
result = if tc.positiveTest?
9999
STDERR.puts "#{"exception:" unless options[:quiet]}: #{e}"
100100
if options[:quiet]

0 commit comments

Comments
 (0)