custom errors with data to help build actionable resolutions, for example if there is a conflict you can give the user the option to shorten the new item so it doesn't conflict or shorten the existing item. having distinct error types with relevant data and not just a string facilitates this.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#custom_error_types
custom errors with data to help build actionable resolutions, for example if there is a conflict you can give the user the option to shorten the new item so it doesn't conflict or shorten the existing item. having distinct error types with relevant data and not just a string facilitates this.