transloadit / php-sdk

Transloadit's official PHP SDK

Home Page:https://transloadit.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lib does not return exception

eerison opened this issue · comments

When there is some problem the lib didn't return a exception

e.g

curl: 6: Could not resolve host: api2.transloadit.com

And there also is no other way to detect this failure? Does the function return an error (string) perhaps?

Yes I can get this error as string and this message Could not resolve host: api2.transloadit.com I got from

$transloadit->createAssembly

But is better you use Exception to manager errors ...

What I was thinking ....

Default Exception

class TransloaditException extends Exception {}

Into createAssembly

public function createAssembly()
{
  try {
        ...... your logic
   catch(\Exception $exception) {
        throw new TransloaditException()
    }
}

When you need to use the createAssembly method

  try {
        $transloadit->createAssembly()
   catch(TransloaditException $exception) {
       you do something .....
    }

There was a time that folks were skeptical about using exceptions in PHP but i gauge that time is well behind us now. I'm open to this change, if @tim-kos is too, but likely we don't have the time to do this anytime soon, would you be open to PRing @eerison?

Sure @kvz I'm forking your project and start to contribute with your project!

Yep sounds good! Looking forward to your PR!

Is this something you'd still like to attack @eerison or should we close the issue?

I think it's good to continue open, to help to track what we need to do

it will be resolved in this Pull request: #34