/** Utility fns to create reusable CommandCreatorErrors */ import type { CommandCreatorError } from './types' ; export function insufficientTips ( ) { return { type : 'INSUFFICIENT_TIPS' , message : 'Not enough tips to complete action' , } ; } export function noTipOnPipette ( args ) { const { actionName , pipette , labware , well } = args ; return { message : `Attempted to ${ actionName } with no tip on pipette: ${ pipette } from ${ labware }'s well ${ well }` , type : 'NO_TIP_ON_PIPETTE' , } ; } export function pipetteDoesNotExist ( args ) { const { actionName , pipette } = args ; return { message : `Attempted to ${ actionName } with pipette id "${ pipette }", this pipette was not found under "pipettes"` , type : 'PIPETTE_DOES_NOT_EXIST' , } ; } export function invalidSlot ( args ) { const { actionName , slot } = args ; return { message : `Attempted to ${ actionName } with slot "${ slot }", this is not a valid slot"` , type : 'INVALID_SLOT' , } ; } export function labwareDoesNotExist ( args ) { const { actionName , labware } = args ; console . warn ( `Attempted to ${ actionName } with labware id "${ labware }", this labware was not found under "labware"` ) ; return { message : 'A step involves labware that has been deleted' , type : 'LABWARE_DOES_NOT_EXIST' , } ; } export function missingModuleError ( ) { return { message : 'This step requires a module, but none is selected' , type : 'MISSING_MODULE' , } ; } export function missingTemperatureStep ( ) { return { message : 'This module is not changing temperature because it has either been deactivated or is already holding a temperature. In order to pause the protocol and wait for your module to reach a temperature, you must first use a Temperature step to tell the module to start changing to a new temperature' , type : 'MISSING_TEMPERATURE_STEP' , } ; } export function tipVolumeExceeded ( args ) { const { actionName , volume , maxVolume } = args ; return { message : `Attempted to ${ actionName } volume greater than tip max volume (${ volume } > ${ maxVolume })` , type : 'TIP_VOLUME_EXCEEDED' , } ; } export function pipetteVolumeExceeded ( args ) { const { actionName , volume , maxVolume , disposalVolume } = args ; const message = disposalVolume != null ? `Attemped to ${ actionName } volume + disposal volume greater than pipette max volume (${ volume } + ${ disposalVolume } > ${ maxVolume })` : `Attempted to ${ actionName } volume greater than pipette max volume (${ volume } > ${ maxVolume })` ; return { message , type : 'PIPETTE_VOLUME_EXCEEDED' , } ; } export const modulePipetteCollisionDanger = ( ) : CommandCreatorError => { return { type : 'MODULE_PIPETTE_COLLISION_DANGER' , message : 'Gen 1 8-Channel pipettes cannot access labware or tip racks in slot 4 or 6 because they are adjacent to modules.' , } ; } ; export const thermocyclerLidClosed = ( ) : CommandCreatorError => { return { type : 'THERMOCYCLER_LID_CLOSED' , message : 'Attempted to pipette into a thermocycler with the lid closed.' , } ; } ;