Is it good practice to show notification on error?

Is it good practice to show this type of notification on general errors?

It looks like material design is suggesting for mobile, but how about web?

Example: User tries to login, but login fails because of server error (not talking about validation error, they are shown under text fields.)

Another example: Saving some data is completed.