Telegram Group & Telegram Channel
Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:
package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23



tg-me.com/golang_for_two/58
Create:
Last Update:

Note #33: Разбор доклада Marwan Sulaiman - Handling Go Errors GopherCon 2019

Марван рассказывает и показывает как они обрабатывают ошибки в New York Times. Основная идея доклада в том, что у вас есть доменная модель и работать с ошибками необходимо по аналогии как Вы работаете с вашей доменной моделью. Делается это лучше всего, в виде type Error struct в пакете errors:

package Errors

// based on https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23
type Error struct {
// a unique string describing a method or a function e.g. getUser
Op op

// can be predefined code/or own code (http/gRPC)
Kind kind

// you can add severity
Severity logrus.Level

// You can add any application Specific Data e.g.
ZipCode string
CreatedAt time.Time
}

Вариант использование:
if err != nil {
return &errors.Error{Op: “getUser”, Error: err}
}

По сути это доклад - это пересечение двух статей [2] и [3] с примерам и подробным описанием что означает каждое поле в структуре Error. Также Марван показывает несколько утилит которые помогают работать с такими ошибками (большая часть из проекта Upspin).

Данный подход помогает не только быстро понять, что и где сломалось в контексте приложения, но и легко настроить фильтры в системе логирования и мониторинга.
Если тема Вам близка то я рекомендую посмотреть видео [1] и/или прочитать еще раз эти статьи [2][3]:

Links:
[1] https://www.youtube.com/watch?v=4WIhhzTTd0Y
[2] https://middlemost.com/failure-is-your-domain/
[3] https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html
[4] https://upspin.googlesource.com/upspin/+/master/errors/errors.go#23

BY 🇺🇦 Go for two :)


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/golang_for_two/58

View MORE
Open in Telegram


🇺🇦 Go на двоих Telegram | DID YOU KNOW?

Date: |

In many cases, the content resembled that of the marketplaces found on the dark web, a group of hidden websites that are popular among hackers and accessed using specific anonymising software.“We have recently been witnessing a 100 per cent-plus rise in Telegram usage by cybercriminals,” said Tal Samra, cyber threat analyst at Cyberint.The rise in nefarious activity comes as users flocked to the encrypted chat app earlier this year after changes to the privacy policy of Facebook-owned rival WhatsApp prompted many to seek out alternatives.

Export WhatsApp stickers to Telegram on iPhone

You can’t. What you can do, though, is use WhatsApp’s and Telegram’s web platforms to transfer stickers. It’s easy, but might take a while.Open WhatsApp in your browser, find a sticker you like in a chat, and right-click on it to save it as an image. The file won’t be a picture, though—it’s a webpage and will have a .webp extension. Don’t be scared, this is the way. Repeat this step to save as many stickers as you want.Then, open Telegram in your browser and go into your Saved messages chat. Just as you’d share a file with a friend, click the Share file button on the bottom left of the chat window (it looks like a dog-eared paper), and select the .webp files you downloaded. Click Open and you’ll see your stickers in your Saved messages chat. This is now your sticker depository. To use them, forward them as you would a message from one chat to the other: by clicking or long-pressing on the sticker, and then choosing Forward.

🇺🇦 Go на двоих from us


Telegram 🇺🇦 Go for two :)
FROM USA