Framework: No hint path defined for [errors]

Created on 9 Oct 2019  路  11Comments  路  Source: laravel/framework

  • Laravel Version: 6.0.4
  • PHP Version: 7.3.9

Description:

Laravel doesn't find path for built in error page layouts such as @extends('errors::minimal') (for neither of errors::minimal, errors::layout, errors::illustrated-layout);

If I publish pages and have ordinary view path pointer it of course works. However I have done it in the past and find it very useful just to extend the vendor provided layout. If it is an intentional change for version ^6.0.0, then this, sadly, may be closed.

Real world example from another L5.8 project

image

Steps To Reproduce:

Clone and serve https://github.com/flexchar/laravel-error-blade-template

Or manual steps:

  1. Create blade view that extends built in error page layout.
    image
@extends('errors::minimal')

@section('title', $title ?? $message)
@section('code', 200)
@section('message', $message ?? $title)
  1. Return it as a view in a route:
return view('pages.simple')->withMessage('they are simple yet pretty');
  1. Get the following error Facade\Ignition\Exceptions\ViewException No hint path defined for [errors]. thrown:
    image

Most helpful comment

Hey Guys,
I had the same issue today, what was solved by changing @extends('errors:minimal') to @extends('errors.minimal') in the view. So change the colon to dot. Hopefully it will help you!

All 11 comments

This looks like an Ignition issue so you might want to open up an issue on their repo: https://github.com/facade/ignition

@driesvints unfortunately not. I deleted Ignition package and yet:
image

I believe the issue shall be reopened.

Here is repo for exact error: https://github.com/flexchar/laravel-error-blade-template

The "errors::" view namespace is only registered on throwing exceptions.
https://github.com/laravel/framework/blob/869f02783a49cd0e16c66c0d362d2e4ea371f4b6/src/Illuminate/Foundation/Exceptions/Handler.php#L382

In fact, you directly call view() helper, there are no exceptions, so it caused the error 'no hinted path defined'

Hey @xuanquynh, that's a great insight.

However I can see that this method/behaviour been there since at least v5.7. Therefore, if it has worked before shouldn't it do now?

shouldn't it do now?

I am not sure, it still depends on your opinion. But I think you should use customized Exceptions to render an error page.

To be clear it is NOT an error I am trying to display. Throughout the application I am working on, there are functions that executes and simply returns plain messages. I want to make use of built-in pretty error pages to display those messages.

I'm hoping that someone else could take a look on it. As unless it is indented to prevent using those layouts, this is unexpected shift in framework behavior. :)

I have no idea. You may register it manually inside a service provider of you project, I think.

I have the same error by doing this:
Bildschirmfoto 2019-12-02 um 18 58 35

https://laravel.com/docs/6.x/errors#render-method

The handler controller:

    public function render($request, Exception $exception)
    {
        if ($exception
            instanceof
            \Illuminate\Database\Eloquent\ModelNotFoundException) {
            return response()->view('errors.nomodel', [], 500);


        }
        return parent::render($request, $exception);
    }

The view:

@extends('errors::minimal')
@section('title', __('Not Found'))
@section('code', '500')
@section('message', __(' Not Found'))

Hey Guys,
I had the same issue today, what was solved by changing @extends('errors:minimal') to @extends('errors.minimal') in the view. So change the colon to dot. Hopefully it will help you!

@MattHowdy Add "$this->registerErrorViewPaths();" line to the very first of render method.

public function render($request, Exception $exception)
{
    $this->registerErrorViewPaths();

   // your logic here.
}

@taylorotwell I had the same issue today. I thanks @xuanquynh for the solution.
May be this should be commited in repository ? Perhaps do you have another idea about this ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anahkiasen picture Anahkiasen  路  3Comments

CupOfTea696 picture CupOfTea696  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

progmars picture progmars  路  3Comments

shopblocks picture shopblocks  路  3Comments