Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/dev/deps/accessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ module Deps
class Accessor
extend T::Sig

class UsageError < StandardError; end
class NotLockedError < StandardError; end
class PlatformNotLockedError < StandardError; end
class NotCachedError < StandardError; end
class NotInstalledError < StandardError; end
# All five are the caller's problem, not dev's, so they descend from
# the two roots Runner#exit_for prints as a clean `dev: …` line (exit
# 1): a malformed invocation or an operand the lockfile does not know
# is an ArgumentError; a locked dep whose artifact is not provisioned
# yet ("run dev up") is a RuntimeError.
class UsageError < RuntimeError; end
class NotLockedError < ArgumentError; end
class PlatformNotLockedError < ArgumentError; end
class NotCachedError < RuntimeError; end
class NotInstalledError < RuntimeError; end

USAGE = "usage: dev deps path ficsit <mod> <platform> | dev deps path xcode | dev deps path gh <name>"

Expand Down
13 changes: 13 additions & 0 deletions test/dev/deps/accessor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,4 +342,17 @@ def setup_locked_gh(dir, installed: true, marker_version: GH_ENGINE_TAG)
"no integration" | []
"too many arguments" | ["ficsit", "SML", "Windows", "extra"]
end

test "#{error} is a #{parent}: the CLI boundary prints it as a clean `dev:` line, never a backtrace" do
Expect "operand errors are ArgumentErrors, not-yet-provisioned states RuntimeErrors (both exit 1 in Runner#exit_for)"
error.superclass == parent

Where
error | parent
Dev::Deps::Accessor::UsageError | RuntimeError
Dev::Deps::Accessor::NotLockedError | ArgumentError
Dev::Deps::Accessor::PlatformNotLockedError | ArgumentError
Dev::Deps::Accessor::NotCachedError | RuntimeError
Dev::Deps::Accessor::NotInstalledError | RuntimeError
end
end
Loading