Problem/Motivation
All of us know the nice "the website encounted an error" message during development. Sadly by default errors aren't shown, so you don't see anything here.
Proposed resolution
One nice little improvement could be to add a link to the error settings page, so you can change it easily.
Remaining tasks
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
#40 | interdiff-2313059-22-40.txt | 6.69 KB | nikunjkotecha |
#40 | 2313059-40.patch | 7.53 KB | nikunjkotecha |
#22 | interdiff-2313059-19-22.txt | 2.39 KB | wturrell |
#22 | 2313059-22.patch | 6.44 KB | wturrell |
#19 | 2313059-19.patch | 4.9 KB | wturrell |
Comments
Comment #1
Wim LeersThat link would then be presented to all end users… which I don't think we want.
The main problem is that many people who are actively working on Drupal 8 core are unaware of the extra step they have to take when installing Drupal 8 (the enabling of
settings.local.php
). Despite the change notice (https://www.drupal.org/node/2259531).How can we make people who are helping Drupal 8 get ready to be more aware of this? I wonder if we can do something like:
$_SERVER['SERVER_ADDR'] === '127.0.0.1'
)file_exists(DRUPAL_ROOT . '/.git'
directory$user->id() == 1
Comment #2
dawehnerWell, you could guess that developers on custom sites might forget that step as well, not doing something here is a big pain in the ass.
Using a git checkout will probably not work, given how many shops use git as a deployment tool (don't say that this is a good idea at all)
Using localhost seems to be the most straightforward way, what do you think?
Comment #3
Wim Leersif (localhost && uid == 1)
works for me.Comment #4
tim.plunkettComment #5
dawehnerI would rather go with || tbh.
Comment #6
dawehner.
Comment #9
vijaycs85+1
$this->t
Comment #10
dawehnerHere is a quick reroll. I still think this could be a massive improvement of some DX.
Comment #12
Wim LeersIsn't
'::1'
in there twice?This method is not implemented?
Comment #13
dawehnerSure, there we go.
Comment #15
dawehnerLet's see, this could help quite a bit.
Comment #19
wturrell CreditAttribution: wturrell as a volunteer commentedRerolled patch on 8.3.x (and about to do some more work on it)
Comment #21
wturrell CreditAttribution: wturrell as a volunteer commentedRe: the failing test:
$subscriber = new DefaultExceptionSubscriber($config_factory);
Our patch means this now needs two parameters. The second is:
Not clear:
- what correct way is to generate user for tests (docs link welcome)
- if it matters which type of user for this one
Comment #22
wturrell CreditAttribution: wturrell as a volunteer commentedChanges:
- use PHP filter to check against full IPv4 private range, not just 127.0.0.1 (struggling to find IPv6 equivalent)
- move ip address check to separate function and generally try to make that conditional easier to follow
- "In order to see the error" text was being shown even when they could already see it, fix this
- improve wording of the message
- coding style/standards
(Test will still fail, see #21, so skipping Testbot)
Comment #23
nikunjkotechaRe-rolled patch from #22, removed code from contrib directory. If we want we should add a PHPUnit test case but not a contrib module.
Comment #25
nikunjkotechaFixed issue with failing tests.
Comment #26
dawehnerCan't this use this helper method? At least the same code should be used.
Note: We don't use "or" but rather ||
Comment #27
wturrell CreditAttribution: wturrell as a volunteer commented@dawehner Ah sorry, I hadn't spotted there was more than one check...
Comment #28
nikunjkotechare-roll with fixes for comments in #26
Comment #29
nikunjkotechaComment #30
wturrell CreditAttribution: wturrell as a volunteer commented@nikunjkotecha:
You've kept the translation in on /DefaultExceptionSubscriber.php, but there's a message in errors.inc saying it's not used because it could create further errors.
Also, in #22, I reworded the message text slightly and wrapped it in a conditional to check that error display was actually turned off - i.e. pointless telling people how to view an error they can already see.
I'd just started working on the patch again when you posted #28, but feel free to do those changes if you like. (Thanks.)
Comment #31
nikunjkotecha@wturrell I'm already using your patch in #22 as base :), I saw your comment but I had already started and was waiting for the tests to finish in local before uploading. Just having enough free time today :)
Comment #33
nikunjkotechasubmitting for re-test, output on dispatcher is not really helpful
Comment #34
nikunjkotechaComment #35
wturrell CreditAttribution: wturrell as a volunteer commentedNo, I realise you used #22. What I mean is there are several changes - besides
_is_private_ip()
, which you've done – in errors.inc than need to be replicated in DefaultExceptionSubscriber.php:- it doesn't use a string translation because, depending on what's broken, that might produce a further error whilst trying to print the error
- I've changed the message text in errors.inc slightly from what it was before
- I added an
if (!error_displayable($error)
conditional(BTW, that problem with your first test run was a random Testbot failure – it lost a connection.)
Comment #37
dawehner+1000 for that.
Comment #38
nikunjkotecha* Removed use of $this->t() in DefaultExceptionSubscriber
* Refactored code a bit
* Copied message from errors.inc to DefaultExceptionSubscriber
* Added interdiff with 22 as base
Comment #40
nikunjkotechaAdded a condition to avoid issues with the call to \Drupal::request()->getClientIps() in _is_private_ip()
Comment #41
swarad07Tested the patch. Applies cleanly and addresses the concerns in #35. Would be a welcome addition to the DX.
Comment #42
cilefen CreditAttribution: cilefen commented8.3.x is in RC.
Comment #54
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
This seems more like a feature request then task
Tagging for tests as the new message is currently not checked.
Also tagging for a change record as we are changing an existing service.
1.
personally I think think $user should default to NULL and a trigger should be added that it will be required in D11
2.
This will need to be typehinted as a new function
3.
same