//~OPTIONS
{
  extends: "@page:system-page",
  include: ["fcf:templates/css/styles.css"],
}

//~ARGUMENTS
{
  title: fcf.argVal("!{{System error}}!"),
}

//~ARGUMENTS body
{
  error:    undefined,
  stack:    fcf.argVal("@{{typeof args.error == 'object' && args.error.stackArr ? args.error.stackArr :" +
                                  "typeof args.error == 'object' && args.error.stack ? args.error.stack :" +
                                  "undefined}}@"),
  subError: fcf.argVal("@{{typeof args.error == 'object' && args.error.subEvent ? args.error.subEvent : undefined}}@"),
}

//~TEMPLATE body
%{{
  let errorCode  = typeof args.error === "object" && args.error.responseCode ? args.error.responseCode : 500;
  let errorTitle = errorCode === 403 ? fcf.t("Access denied") :
                                       fcf.t("Internal server error");
}}%

<div class="body">

  <div class="message">
    <h3>!{{Message}}!:</h3>
    ${{args.error}}$
  </div>

  %{{ if (!fcf.empty(args.subError)) { }}%
  <div class="submessage">
    <h3>!{{Nested message}}!:</h3>
    ${{args.subError}}$
  </div>
  %{{ } }}%


  %{{ if (!fcf.empty(args.stack)) { }}%
    <div class="description">
    <h3>!{{Details}}!:</h3>
    <p>Stack:</p>
    <pre>
${{args.stack}}$
    </pre>
    </div>
  %{{ } }}%

</div>


