Unhandled exception when user is not assigned to application


I have multiple application settings in okta ,now I want to assign different group of okta users to each of those applications.I’m able to manage the same and it’s working fine for respective assigned users. But the problem is happening once any unassigned okta user tries to login another application where he is not tagged.It’s throwing unhandled exception from my asp.net MVC Application.
I’m using
app.UseOktaMvc(new OktaMvcOptions()
OktaDomain = ConfigurationManager.AppSettings[“okta:OktaDomain”],
ClientId = ConfigurationManager.AppSettings[“okta:ClientId”],
ClientSecret = ConfigurationManager.AppSettings[“okta:ClientSecret”],
RedirectUri = ConfigurationManager.AppSettings[“okta:RedirectUri”],
PostLogoutRedirectUri = ConfigurationManager.AppSettings[“okta:PostLogoutRedirectUri”],
Scope = new List { “openid”, “profile”, “email” },
AuthorizationServerId = string.Empty,
LoginMode = LoginMode.OktaHosted,
GetClaimsFromUserInfoEndpoint = true,

in my startup page. And it’s throwing below exception

“OpenIdConnectMessage.Error was not null, indicating an error. Error: ‘access_denied’. Error_Description (may be empty): ‘User is not assigned to the client application.’. Error_Uri (may be empty): ‘error_uri is null’.”

I’m not able to catch this error.Please let me know how to handle this exception in code without showing yellow error page .

Thanks & regards,