Errors, warnings and exceptions raised in Wikibase REST API code should be logged in production's environment log collection so they can be monitored, analyzed and reasoned about.
Currently Mediawiki REST API does not provide error logging, it seems.
For comparison, Mediawiki Acton API seems to be relying on global functions like wfDebugLog which send logs to a proper logger and intended channel.