Skip to content

Commit

Permalink
Merge pull request #1035 from amvanbaren/feature/custom-error-page
Browse files Browse the repository at this point in the history
Add ServerErrorController
  • Loading branch information
amvanbaren authored Nov 6, 2024
2 parents 02f393f + 54cfb9a commit c123517
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/** ******************************************************************************
* Copyright (c) 2024 Precies. Software OU and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
* ****************************************************************************** */
package org.eclipse.openvsx.web;

import org.eclipse.openvsx.util.UrlUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@ConditionalOnProperty(value = "server.error.path", havingValue = "/server-error")
public class ServerErrorController implements ErrorController {

@Value("${ovsx.webui.url:}")
String webuiUrl;

@RequestMapping("/server-error")
public String handleError() {
return "redirect:" + UrlUtil.createApiUrl(webuiUrl, "error");
}
}

0 comments on commit c123517

Please sign in to comment.