我最近格式化我的mac book pro,从github克隆了proyect并安装了我需要的东西,比如MySql和Sequel Pro我试图迁移数据库信息,但是我收到了这个错误:
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER' (SQL: select * from information_schema.tables where table_schema = fisica and table_name = migrations)
Exception trace:
1 PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1231 Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'")
Run Code Online (Sandbox Code Playgroud)
版本:
Mysql 8.0.11
Laravel 5.6.12
PHP 7.1.14(cli)
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=fisica
DB_USERNAME=xxx
DB_PASSWORD=xxx
Run Code Online (Sandbox Code Playgroud)
我从Sequel PRO GUI创建了数据库
我在javascript中对async await相当新,所以这个问题可能是我不知道的.
我有这个
async foo(req, res, next) {
try {
await scan(req.params.stack);
res.send('ok');
} catch (err) {
res.status(500).send('fail');
}
}
async scan(stack) {
try {
const libs = [1,2,3];
const promises = libs.map(async l => analyze(stack, l)
.catch((err) => { throw new Error(err); }));
return q.allSettled(promises)
.then((results) => {
const rejected = results.filter(r => r.state === 'rejected');
if (rejected.length === results.length) throw new Error('Failed');
return results;
})
.catch((err) => {
throw new Error(err);
});
} catch (err) {
throw new …
Run Code Online (Sandbox Code Playgroud) 这是我在单元测试时遇到的一个设计问题。\n让我们深入研究示例:
\n想象一下:
\nasync function foo()\xc2\xa0{\n try {\n return apiCall()\n }\n catch (e) {\n throw new CustomError(e);\n } \n}\n\n\n\nasync function bar() {\n return foo()\n}\n\n\n\nasync function main() {\n try {\n await bar()\n }catch(e) {\n console.error(e)\n }\n}\n\nmain()\n
Run Code Online (Sandbox Code Playgroud)\n我们在这里看到什么?唯一没有 try-catch 块的函数是 bar。\n但是如果 foo 失败,它应该被 main catch 捕获。
\n虽然像这样进行单元测试
\ndescribe(\'testing bar\', () => {\n it(\'foo should throw\', () => {\n foo.mockImplementantion(() => { throw new CustomError(\'error\')});\n bar()\n .then((result) => console.log(result))\n .catch((err) => { exepect(err).toBeInstanceOf(CustomError)}) // this is what we are …
Run Code Online (Sandbox Code Playgroud)