Giter Site home page Giter Site logo

goreminder's People

Contributors

xieyuschen avatar

Stargazers

 avatar

Watchers

 avatar  avatar

goreminder's Issues

All panic need have a recover to avoid stop the whole program

例如邮件服务,网络请求的服务如果失败会调用panic函数,如果没有对panic进行处理那么直接导致程序错误退出。如之前因为请求错误导致的panic退出程序:

goroutine 1890 [running]:
GoReminder/WebScanner.ArticleUrlAndSubject.func1(0x0, 0xc0000101d0)
        /GoReminder/WebScanner/scanner.go:19 +0x47
GoReminder/WebScanner.ArticleUrlAndSubject(0x8796fc, 0x1b, 0xc0001d66c0)
        /GoReminder/WebScanner/scanner.go:39 +0xf3
created by GoReminder/Reminder.Reminder
        /GoReminder/Reminder/reminder.go:34 +0x3d8
exit status 2

就属于典型的没有对panic进行恢复导致的程序崩溃。需要解决

Panic must couple with Recover:)

一个好的panic一定要有recover,否则错误处理结束的调用栈会直接把整个程序给关闭掉,但实际上我想要做的事情只是把当前panic在的这个函数给结束了。
所以说代码扔到服务器上中间估计碰到一个小panic就直接结束了。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.