Git Product home page Git Product logo

Comments (6)

mlboy avatar mlboy commented on August 22, 2024

这不是报错。 你看你main文件,例子中把err panic 了

from jupiter.

gorexlv avatar gorexlv commented on August 22, 2024

退出的错误信息显示不太友好,可以优化一下体验

from jupiter.

mlboy avatar mlboy commented on August 22, 2024

退出的错误信息显示不太友好,可以优化一下体验

现在 gin 的example 和 echo 的example 是保持一致的

https://github.com/douyu/jupiter/blob/master/example/http/simple/main.go#L27
https://github.com/douyu/jupiter/blob/master/example/http/gin/main.go#L27

把错误级别由Panic调整成Error ,如下?

//把
xlog.Panic(err.Error())
//调整为:
xlog.Error(err.Error())

形成如下提示:

image

这样调整?

还是从从根本上能区分出主动关闭,即主动关闭时候 仍然抛出 info信息?

from jupiter.

gorexlv avatar gorexlv commented on August 22, 2024

@mlboy 我的想法是识别Server Closed错误,然后结合上下文优化一下抛错误的体验。
有些发布、监控系统会监听错误输出和退出码,Error/Panic的方式都不优雅。

2d1b7c2 简单的屏蔽了ServerClosed/ServerStop错误。后面考虑更优雅的方案

from jupiter.

qiujiafei avatar qiujiafei commented on August 22, 2024

退出的错误信息显示不太友好,可以优化一下体验

没注意看 gin 例子中的是 xlog.panic ,以为是退出的某个环节内部 panic 了, 这个是调用方主动将 err panic 了, 那这个报错也正常, 我的锅 😭

from jupiter.

mlboy avatar mlboy commented on August 22, 2024

@mlboy 我的想法是识别Server Closed错误,然后结合上下文优化一下抛错误的体验。
有些发布、监控系统会监听错误输出和退出码,Error/Panic的方式都不优雅。

2d1b7c2 简单的屏蔽了ServerClosed/ServerStop错误。后面考虑更优雅的方案

嗯,另外有个问题就是:非主动退出时,无法感知server close行为。服务常态是一直运行,在退出时候能感知到服务的状态变化。在主动关闭时,多收到一个通知,会比没有通知好点。

from jupiter.

Related Issues (20)

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.