How to inform the user that the save was not successful?

Handling admin notice on Edit Post

When action related to post or editpost, we will be faced with redirect_post function. There are two filters you can use to handle the post messages, redirect_post_location and post_updated_messages ( see the list messages at https://core.trac.wordpress.org/browser/tags/4.8/src/wp-admin/edit-form-advanced.php#L135 ).

Here the sample code how to handle the messages.

Create new message (optional)

add_filter( 'post_updated_messages', function( $messages ) {
    //create another message code, i.e 11
    $messages['post'] = $messages['post'] + array( 11 => __( 'Something Wrong', 'textdomain' ) );

    return $messages;
} );

Handling redirection

add_filter( 'redirect_post_location', function( $location, $post_id ) {
    //let say the conditon is false, or you can create your code here
    $condition = false;

    if ( ! $condition ) //add 11 as code message or use in the list post messages
        $location = add_query_arg( 'message', 11, get_edit_post_link( $post_id, 'url' ) );


    return $location;
}, 10, 2 );

As those codex reference, code 0 will be give us no notice. The notice will always give update notice (green color), if we need error or warning notice, I suggest to create own admin notice. I hope this help.