Skip to content

Commit 03cb586

Browse files
committed
refactor: better scale errors
1 parent 46230c5 commit 03cb586

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/utils/buildAxis.linear.ts

+14-10
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ function buildTimeAxis<TDatum>(
134134
options.getValue(datum.originalDatum)
135135
)
136136

137-
if (minValue === undefined) {
138-
throw new Error('Invalid scale min/max')
139-
}
140-
141-
if (maxValue === undefined) {
137+
if (minValue === undefined || maxValue === undefined) {
138+
console.info({
139+
options,
140+
series,
141+
range,
142+
values: allDatums.map(d => options.getValue(d.originalDatum)),
143+
})
142144
throw new Error('Invalid scale min/max')
143145
}
144146

@@ -194,11 +196,13 @@ function buildLinearAxis<TDatum>(
194196
)
195197
: extent(allDatums, datum => options.getValue(datum.originalDatum))
196198

197-
if (minValue === undefined) {
198-
throw new Error('Invalid scale min/max')
199-
}
200-
201-
if (maxValue === undefined) {
199+
if (minValue === undefined || maxValue === undefined) {
200+
console.info({
201+
options,
202+
series,
203+
range,
204+
values: allDatums.map(d => options.getValue(d.originalDatum)),
205+
})
202206
throw new Error('Invalid scale min/max')
203207
}
204208

0 commit comments

Comments
 (0)