Customise error messages

Hello,
I use JupyterHub (actually, it’s Z2JH) with custom oauth (OpenID Connect) authentication (oauthenticator.generic.GenericOAuthenticator). In certain cases, after logging in, it shows error messages like “403 : Forbidden” (which is expected). I’d like rather to show message like “Wait for admin to activate your account” instead of raw “Forbidden”.

Is it possible to customise error messages like this?

If there are no such configuration options available, then where are templates for such error pages kept?

Thank you,
Michal

Hello,
is anyone able to suggest on this?

Best,
Michal

Not sure if it’s the correct way, but I’ve had luck in modifying \notebook\static\notebook\js\notebook.js to trap a custom error that I’m sending from file save():

    if (data.message) {
        if(data.message.startsWith("Warning: you are running low on storage space;")){
            var title = i18n.msg._("Storage Capacity Warning");
            body.append($("<p>").text(data.message));
                dialog.modal({
                    notebook: this,
                    keyboard_manager: this.keyboard_manager,
                    title: title,
                    body: body,
                    buttons : {
                        OK : {
                            "class" : "btn-primary"
                        }
                    }
                });
            this.events.trigger('notebook_saved.Notebook');
            this._update_autosave_interval(start);
            if (this._checkpoint_after_save) {
                this.create_checkpoint();
                this._checkpoint_after_save = false;
            }                
        }

Maybe you could do something similar, poking around until you find the .js file that displays the message?