<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _raise_on_error(data: Union[str, dict]) -> None: """Raise the appropriate exception on error."""

    if isinstance(data, str):
        raise_error(data)
    elif 'status' in data and data['status'] != 'success':
        raise_error(data['data']['message'])