ronon

ronon

Member Since 2 Years Ago

Experience Points
28,330
Total
Experience

1,670 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
219
Lessons
Completed
Best Reply Awards
3
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 6
28,330 XP
Apr
15
1 month ago
Activity icon

Replied to Throw Exception With Specifc Status Code? (Misunderstanding?)

Feeling dump now. On other exceptions I override the render method, don't know why I thought what I wrote

Apr
14
1 month ago
Activity icon

Started a new Conversation Throw Exception With Specifc Status Code? (Misunderstanding?)

Currently my understanding of Exceptions is, that if you have a custom exception like: DontKnowException

<?php

namespace App\Exceptions;

use Exception;

class DontKnowException extends Exception
{
    //
}

and you pass a code to it when you throw it

                throw new DontKnowException('Dont know what youre trying todo....', 412);

the exception should return the message with the provided 412 statuscode, or not? I currently always receive a 500 statuscode.

I'm currently on v5.8

Mar
24
2 months ago
Activity icon

Replied to Try Catch With Php7 Won't Log The Error

That's the point which confuses me.

Tried this piece of code

try {
                $sm = new SubtitleManager();
                $sm->createChapters($request->fileinfo['chapters'], $file);
            } catch (\Throwable $e){
                dd($e);
            } 
dd('end');

with corrupted data. When using \Exception it breaks, with \Throwable only dd('end'); is exectued

Mar
23
2 months ago
Activity icon

Replied to Try Catch With Php7 Won't Log The Error

@sti3bas that's what it thought as well, but i tried to dd() it but the dd is skipped and the code outside the try catch is executed. That's what really confuses me.

Activity icon

Started a new Conversation Try Catch With Php7 Won't Log The Error

I have this piece of code which handles the storage of subtitles

try {
                $sm = new SubtitleManager();
                $sm->createChapters($request->fileinfo['chapters'], $file);
            } catch (\Exception $e){
                Log::error('Subtitle store exception: ' . $e->getMessage(), $e->getTrace());
            } 

I now occurenced a random edge case where the exception won't handle the error:

Argument 1 passed to Done\Subtitles\VttConverter::internalFormatToFileContent() must be of the type array, null given, called in /var/www/html/laravel/vendor/mantas-done/subtitles/src/Subtitles.php on line 121 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Argument 1 passed to Done\Subtitles\VttConverter::internalFormatToFileContent() must be of the type array, null given, called in /var/www/html/laravel/vendor/mantas-done/subtitles/src/Subtitles.php on line 121 at /var/www/html/laravel/vendor/mantas-done/subtitles/src/code/Converters/VttConverter.php:42)

I then googled why the exception won't track the error and found this article https://trowski.com/2015/06/24/throwable-exceptions-and-errors-in-php7/

Then I tried two different approaches two fix the issue: First:

try {
                $sm = new SubtitleManager();
                $sm->createChapters($request->fileinfo['chapters'], $file);
            } catch (\Throwable $e){
                Log::error('Subtitle store exception: ' . $e->getMessage(), $e->getTrace());
            } 

but it wouldn't log an error.

The I tried

try {
                $sm = new SubtitleManager();
                $sm->createChapters($request->fileinfo['chapters'], $file);
            } catch (\Exception $e){
                Log::error('Subtitle store exception: ' . $e->getMessage(), $e->getTrace());
            } catch (\Error $e){
                Log::error('Subtitle store error: ' . $e->getMessage(), $e->getTrace());
            }

but it wouldn't log the error at all.

With both approaches the code works, as it should, but I didn't log anything.

As far as I understand, my original code won't work, because the error isn't thrown as \Exception correct? Also the article I mentioned that everything implements the Throwable interface, should I use Throwable anyways in php 7? And why isn't my second or third approach not Logging the error at all?

Jan
09
4 months ago
Activity icon

Awarded Best Reply on Mocking A File In A Storage For A PHPUnit Test?

You could also use

$file = UploadedFile::fake()->create('image.jpg')
        ->storeAs('app/images', newfilename.jpg)');

With this you could also create any kind of formats like pdf etc.

Activity icon

Replied to Mocking A File In A Storage For A PHPUnit Test?

You could also use

$file = UploadedFile::fake()->create('image.jpg')
        ->storeAs('app/images', newfilename.jpg)');

With this you could also create any kind of formats like pdf etc.

Nov
29
5 months ago
Activity icon

Replied to Long Running Queues Fails And Executes Successfully At The Same Time

Seems not to be a memory issue. I modified the function that throws the exception to log whats happening:

protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($connectionName, $job, $maxTries)
    {
        $maxTries = ! is_null($job->maxTries()) ? $job->maxTries() : $maxTries;

        $timeoutAt = $job->timeoutAt();

        Log::debug('timeout at: ' . ($timeoutAt ?? 'not set') . ' - timeout ' . $job->timeout() .
                    ' - max tries: ' . $maxTries . ' - attempts: ' . $job->attempts());

        if ($timeoutAt && Carbon::now()->getTimestamp() <= $timeoutAt) {
            return;
        }

        if (! $timeoutAt && ($maxTries === 0 || $job->attempts() <= $maxTries)) {
            return;
        }

        Log::error('Throw exception... timeout at: ' . ($timeoutAt ?? 'not set') . ' - timeout ' . $job->timeout() .
            ' - max tries: ' . $maxTries . ' - attempts: ' . $job->attempts());

        $this->failJob($job, $e = new MaxAttemptsExceededException(
            $job->resolveName().' has been attempted too many times or run too long. The job may have previously timed out.'
        ));

        throw $e;
    }

This is in the log:

[2019-11-29 00:31:27] production.DEBUG: timeout at: not set - timeout 0 - max tries: 1 - attempts: 1
[2019-11-29 00:31:28] production.DEBUG: timeout at: not set - timeout 0 - max tries: 1 - attempts: 2
[2019-11-29 00:31:28] production.ERROR: Throw exception... timeout at: not set - timeout 0 - max tries: 1 - attempts: 2

It seems that the attempts is increased without any reason. Have to dig further to see why the attempts are increased :/

Nov
27
5 months ago
Activity icon

Replied to Long Running Queues Fails And Executes Successfully At The Same Time

@talinon Yes all workers have been restarted after the change.

Will take a look at sar. Maybe it's really an memory issue.

Diskspace is monitored and is configured to not fill the disk only to a certain limit