Skip to content

Commit 88ca170

Browse files
authored
fix: add general Error parent class (#8)
This makes it easy to catch all errors thrown by this gem without having to list them specifically.
1 parent f6dc52f commit 88ca170

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

lib/aws_ec2_environment.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
require "socket"
33
require "yaml"
44

5-
require_relative "aws_ec2_environment/ssm_port_forwarding_session"
6-
require_relative "aws_ec2_environment/ci_service"
7-
require_relative "aws_ec2_environment/config"
8-
require_relative "aws_ec2_environment/version"
9-
105
class AwsEc2Environment
11-
class BastionNotExpectedError < StandardError; end
12-
class BastionNotFoundError < StandardError; end
13-
class EnvironmentConfigNotFound < StandardError; end
6+
class Error < StandardError; end
7+
class BastionNotExpectedError < Error; end
8+
class BastionNotFoundError < Error; end
9+
class EnvironmentConfigNotFound < Error; end
10+
11+
require_relative "aws_ec2_environment/ssm_port_forwarding_session"
12+
require_relative "aws_ec2_environment/ci_service"
13+
require_relative "aws_ec2_environment/config"
14+
require_relative "aws_ec2_environment/version"
1415

1516
attr_reader :config
1617

lib/aws_ec2_environment/ssm_port_forwarding_session.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
class AwsEc2Environment
88
class SsmPortForwardingSession
9-
class SessionIdNotFoundError < StandardError; end
10-
class SessionTimedOutError < StandardError; end
11-
class SessionProcessError < StandardError; end
9+
class SessionIdNotFoundError < Error; end
10+
class SessionTimedOutError < Error; end
11+
class SessionProcessError < Error; end
1212

1313
# @return [String]
1414
attr_reader :instance_id

sig/aws_ec2_environment.rbs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
class AwsEc2Environment
22
VERSION: String
33

4-
class BastionNotExpectedError < StandardError
4+
class Error < StandardError
55
end
66

7-
class BastionNotFoundError < StandardError
7+
class BastionNotExpectedError < Error
88
end
99

10-
class EnvironmentConfigNotFound < StandardError
10+
class BastionNotFoundError < Error
11+
end
12+
13+
class EnvironmentConfigNotFound < Error
1114
end
1215

1316
attr_reader config: Config

sig/aws_ec2_environment/ssm_port_forwarding_session.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class AwsEc2Environment
22
class SsmPortForwardingSession
3-
class SessionIdNotFoundError < StandardError
3+
class SessionIdNotFoundError < Error
44
end
55

6-
class SessionTimedOutError < StandardError
6+
class SessionTimedOutError < Error
77
end
88

9-
class SessionProcessError < StandardError
9+
class SessionProcessError < Error
1010
end
1111

1212
attr_reader instance_id: String

0 commit comments

Comments
 (0)