mesa: Merge handling of application-provided and built-in error sources.