Skip to content

Commit

Permalink
use similar error messages when missing versionId
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomás Ciccola committed Jul 31, 2024
1 parent c851be6 commit e6c0ede
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/decode-conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const convertPreset: ConvertFunction<'preset'> = (
addTags: convertTags(rest.addTags),
removeTags: convertTags(rest.removeTags),
fieldRefs: rest.fieldRefs.map(({ docId, versionId }) => {
if (!versionId) throw new Error('missing versionId for fieldRef')
if (!versionId) throw new Error('missing fieldRef.versionId for preset')
return {
docId: docId.toString('hex'),
versionId: getVersionId(versionId),
Expand Down Expand Up @@ -226,7 +226,8 @@ export const convertTrack: ConvertFunction<'track'> = (message, versionObj) => {
const locations = message.locations.map(convertTrackPosition)
const observationRefs = message.observationRefs.map(
({ docId, versionId }) => {
if (!versionId) throw new Error('missing versionId from observationRef')
if (!versionId)
throw new Error('missing observationRef.versionId from track')
return {
docId: docId.toString('hex'),
versionId: getVersionId(versionId),
Expand Down

0 comments on commit e6c0ede

Please sign in to comment.