Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
452f5e0c
Unverified
Commit
452f5e0c
authored
Mar 25, 2022
by
smartcontracts
Committed by
GitHub
Mar 25, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2366 from ethereum-optimism/sc/fix-base-service-options
fix(cmn): have BaseService throw on missing options
parents
024e444b
51673b90
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
sharp-terms-pay.md
.changeset/sharp-terms-pay.md
+5
-0
base-service-v2.ts
packages/common-ts/src/base-service/base-service-v2.ts
+10
-0
No files found.
.changeset/sharp-terms-pay.md
0 → 100644
View file @
452f5e0c
---
'
@eth-optimism/common-ts'
:
patch
---
Have BaseServiceV2 throw when options are undefined
packages/common-ts/src/base-service/base-service-v2.ts
View file @
452f5e0c
...
...
@@ -218,6 +218,16 @@ export abstract class BaseServiceV2<
return
acc
},
{})
as
TOptions
// Make sure all options are defined.
for
(
const
[
optionName
,
optionSpec
]
of
Object
.
entries
(
params
.
optionsSpec
))
{
if
(
optionSpec
.
default
===
undefined
&&
this
.
options
[
optionName
]
===
undefined
)
{
throw
new
Error
(
`missing required option:
${
optionName
}
`
)
}
}
// Create the metrics objects.
this
.
metrics
=
Object
.
keys
(
params
.
metricsSpec
||
{}).
reduce
((
acc
,
key
)
=>
{
const
spec
=
params
.
metricsSpec
[
key
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment