io.imunity.home.views.HomeErrorPage Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2018 Bixbit - Krzysztof Benedyczak. All rights reserved.
* See LICENCE.txt file for licensing information.
*/
package io.imunity.home.views;
import org.apache.logging.log4j.Logger;
import com.vaadin.flow.component.Composite;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.router.BeforeEnterEvent;
import com.vaadin.flow.router.ErrorParameter;
import com.vaadin.flow.router.HasErrorParameter;
import com.vaadin.flow.router.ParentLayout;
import jakarta.annotation.security.PermitAll;
import jakarta.servlet.http.HttpServletResponse;
import pl.edu.icm.unity.base.message.MessageSource;
import pl.edu.icm.unity.base.utils.Log;
@PermitAll
@ParentLayout(HomeUiMenu.class)
public class HomeErrorPage extends Composite implements HasErrorParameter
{
private static final Logger log = Log.getLogger(Log.U_SERVER_WEB, HomeErrorPage.class);
private final MessageSource messageSource;
HomeErrorPage(MessageSource messageSource)
{
this.messageSource = messageSource;
}
@Override
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter parameter)
{
log.error("Vaadin rendering error:", parameter.getCaughtException());
getElement().setText(messageSource.getMessage("Error"));
return HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy