Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

资源找不到,在非调试模式下,应该返回空或null,而不是异常 #89

Open
jorry2008 opened this issue Aug 13, 2021 · 0 comments

Comments

@jorry2008
Copy link

Aliyun-oss-storage/src/AliOssAdapter.php
为什么在这里获取url,不存在时直接就异常!

/**
* @param $path
*
* @return string
*/
public function getUrl( $path )
{
if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found');
return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/');
}

路径无法找到,仅仅是资源不存在而已,并不是程序无法进行下去,返回空或者null都可以,这里返回异常导致整个程序奔溃。
这里没有结合laravel的环境,调试模式下异常抛出会不会更好,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant