Error messages should provide specific context and actionable guidance to help developers understand and resolve issues effectively. Include relevant identifiers (class names, file paths, method names) and clear recovery instructions when possible.
Key practices:
Cannot access "MyDurableObject#ping"
)Example:
// Poor: Generic error without context
throw new Error("Upload failed");
// Better: Specific context and recovery guidance
throw new FatalError(
`Asset upload took too long on bucket ${bucketIndex + 1}/${totalBuckets}. ` +
`Please try again - assets already uploaded have been saved, so the next attempt will automatically resume from this point.`
);
This approach reduces debugging time and improves the developer experience by making failures self-explanatory and recoverable.
Enter the URL of a public GitHub repository