在鈦坦那邊花了蠻多時間把產品架構面的 error handling 機制弄好,不再是到處 try/catch 只寫 log return false.
不再是無謂的 try/catch re-throw exception.
不再是 catch(ex) throw ex; 的該死寫法。甚至吃掉 exception 不做事的情況。
該記 log 的只在邊界層,透過 decorator/action filter/middleware 來封裝與加載。也不再有那種 log 只記到表層的 call stack 而沒記錄到 inner exception 真正的問題發生點。
該做 error handling 或附加 run time 的資訊,handle 完 re-throw 自定義的 custom business exception, 再交給 error handling 底層來觸發對應的 error handler。
在發現問題(例外)的第一時間點 throw exception 通知整個 process 發生了什麼問題。
整個 call stack 與方法簽章都是乾乾淨淨的「正常流程」,沒有不必要的 return true/false 來通知是否有異常,也沒有不必要的 error code Enum 來一路傳遞回呼叫端。
發生怎樣的異常,該決定怎樣的 error code/status code 通知呼叫端,是最後要回傳結果那一層的 error handle 職責與行為。
Error handling 本身就是一整門學問,能在企業等級產品架構裡面打好這段基礎,可以指數性降低 application design 的複雜度。
鈦坦的產品工程師扛霸子之一的 Jrting ,開始把這門知識整理成系列文了,希望能給大家一些幫助。
https://medium.com/@neokn/exception-%E6%80%8E%E9%BA%BC%E4%B8%9F%E6%89%8D%E4%B8%9F%E5%BE%97%E6%BA%96-a385bd27ed15
同時也有2部Youtube影片,追蹤數超過15萬的網紅pennyccw,也在其Youtube影片中提到,No matter how many shots he took, Allen Iverson couldn't beat the Atlanta Hawks by himself. Iverson scored 53 points, the fifth-highest total of his ...
「throw exception」的推薦目錄:
- 關於throw exception 在 91 敏捷開發之路 Facebook 的精選貼文
- 關於throw exception 在 91 敏捷開發之路 Facebook 的最佳貼文
- 關於throw exception 在 Trainer Singh Facebook 的精選貼文
- 關於throw exception 在 pennyccw Youtube 的最佳貼文
- 關於throw exception 在 pennyccw Youtube 的最佳解答
- 關於throw exception 在 例外處理(Exception) - Java學習筆記 的評價
- 關於throw exception 在 When to catch the Exception vs When to throw the Exceptions? 的評價
- 關於throw exception 在 Throwing an exception inside finally - Software Engineering ... 的評價
- 關於throw exception 在 Learn Java - Beginner 43 - Throw your own Exception 的評價
throw exception 在 91 敏捷開發之路 Facebook 的最佳貼文
沒想到是四年前的文章了...
會突然有感,是因為最近有碰到被 coaching 的小夥伴在查 stack overflow 相關資料,並嘗試解決他所碰到的問題之後,就繼續先往下工作了。(這並沒有錯,工作時間嘛,事有緩急)
不過觀察到這情況後,我好奇問了一下他相關的問題。
「你知道這樣寫,跟那樣寫的差異在哪裡嗎?」
「你看這個被標的解答,跟下面那個投票很多的解答,哪一種寫法好?你剛剛貼的那個被標為解答的,雖然解決了你的問題,但為什麼再下面那一篇的 vote 數那麼高?」
「你有發現解答下面還蠻多 reference link 的嗎?就你過去的習慣,從 stack overflow 上解決了你工作碰到的問題之後,你會有後續的其他動作嗎?」
a few minutes later....
91:「學習的起點,通常也是難度很高的點,是發現自己的無知跟未知。當你發現一個東西你不會、不知道時,你才可能學會它。
你好不容易可以在 routine 的工作裡面,碰到一個你不會的東西,已經發現了自己的未知了,卻只是應付工作上的問題,不求甚解。反正下次再 google 下次在 stack overflow 上還是可以找到其他人的解答。
那你這根本沒在學習,你只是在應付。
舉例來說,你碰到了一個 C# 裡面應該用 throw; 而非 throw ex;
你應該問,為什麼?明明 throw ex; 看起來直覺很多啊。
而且你不應該只問為什麼,不應該只知道 throw 跟 throw ex 的差異,你應該順便了解 Exception 身上有哪些東西,怎麼記 exception 的 log,為什麼有一堆東西是 readonly 的,為什麼有 4 個 constructor,該怎麼自訂自己的 Exception,為什麼需要自訂 Exception,怎麼處理 error handling,誰丟 exception 出來才是對的,誰攔 exception 處理才是對的。
什麼情況適合用怎樣的作法,來解決你實務上的需求情境。」
這些,才是從一個你未知的點,擦出火花之後,學習知識點,再到知識面。
這,才叫學習。
throw exception 在 Trainer Singh Facebook 的精選貼文
I once knew someone that had an issue because of this.
.
1. Vaginal discharge is normal.
2. Wearing panty liners 24/7 is not necessary.
3. Vaginas are acidic enough to BLEACH fabric, hence the discoloration of underwear.
4. Longer labias are more common than smaller ones (but both are fine). 5. A mans sperm CAN throw off your pH balance and also change the smell of your vagina
6. It is not safe for vaginas to smell like sunshine and flowers so quit expecting it to.
7. STOP douching and washing your vagina with bath&body works, and Victoria secret. Its not healthy for the vagina.
8. The vagina cleans itself.
9. Having sex has no correlation of how "tight" your vagina is.
10. Yeast infections are COMMON!!!
11. The best thing you can do for your vagina is to leave it alone.😴
12. If your vagina stinks (fish, garbage, sour milk) or your discharge stink and has a color (yellowish, tan , brown, green) then go see a Gynecologist and stop trying to blame cause you stink.
13. Let it breathe.
14. The VAGINA is the narrow canal that runs INSIDE the body. NOT the whole genital area.
*Do not use soap in your vagina.*
15. Always urinate after sex to rinse the urinary tract of fluids that could be caught there and can cause UTIs(urinary tract infections).
16. Drink water.
17. COTTON panties ladies. Wearing silk, satin and lace seven days a week will abso-freakin-lutely throw your pH off.
Don't argue with me about this. I don't care if you say your mama put you in satin diapers and all you've ever worn are satin panties. If that's true, YOUR FLORA IS OFF. I GUARANTEE it.
18. Stop sprinkling powder on your lady bits, stop IMMEDIATELY! Studies show Talcum causes cancer. This isn't a hoax or a joke and I don't care if your 97 year old great Aunt Myrtle has been using it twice a day, everyday. STOP IT! TODAY!
19. Also the Vagina is a natural sperm killer, except when you’re ovulating with the exception of a very high pH level.
20. This is all correct and true. Stop letting men who think washing their @ss and moisturizing is gay try and tell you how to care for YOUR ladybits. Ladies, stop letting boys who got sex ed from Pornhub tell you about YOUR vagina.
#trainersingh
throw exception 在 pennyccw Youtube 的最佳貼文
No matter how many shots he took, Allen Iverson couldn't beat the Atlanta Hawks by himself.
Iverson scored 53 points, the fifth-highest total of his career, but Joe Johnson had 24 to lead the Hawks over the Philadelphia 76ers 111-108 on Friday night.
"I'm as disappointed as everybody else on my team," Iverson said. "We wanted to go into the holidays with a win. We'll have to get this one out of our system and come back to work."
Zaza Pachulia added a career-high 23 points, including the go-ahead free throws, and Al Harrington scored 22 for Atlanta, which won its fourth straight at home and its fifth in the last seven games overall.
"We shared the ball," Pachulia said. "We had 29 assists, and that's great. We shot pretty good also, 54 percent. It's tough to beat a team like that."
Iverson, who entered with a league-best 33.5 scoring average, had 21 points and six rebounds in the first half. He shot 17-of-31 and hit 19 of 21 free throws, the last coming on a three-point play that cut the Atlanta lead to 101-100 with 5:20 remaining.
He broke the record that Shareef Abdur-Rahim set at 7-year-old Philips Arena with a 50-point performance against Detroit on Nov. 23, 2001. Iverson has scored 50 in nine games, including a career-best 60-point effort in a 112-99 win over Orlando last Feb. 12.
Iverson gave the Sixers their last lead when his runner over Johnson and Pachulia made it 105-104 with just under 3 minutes remaining. Pachulia then made two free throws, then added a jumper for a three-point lead.
On Philadelphia's last five possessions, John Salmons missed two straightaway 3-point attempts and had a fast-break layup blocked by Atlanta's Josh Smith.
"When someone is scoring like that, everybody else isn't involved," Harrington said. "When they do shoot, they're ice cold, so that worked in our favor."
Iverson drove past Salim Stoudamire and Harrington after a steal for the Sixers' last basket, a layup that cut Atlanta's lead to 110-108 with 36 seconds remaining. Philadelphia had the ball with 2.4 seconds left when Iverson made an inbounds pass in front of the Atlanta bench to Chris Webber, who missed an 8-foot turnaround jumper.
"I told him before the play that if both men went to me, to go to the basket and get a good shot," Iverson said. "Things didn't go the way we wanted tonight."
Johnson made one free throw, then jumped to intercept Andre Iguodala's long pass from the Hawks' baseline.
Two free throws by Iverson gave the Sixers their biggest lead at 82-70 in the third quarter, but the Hawks went on a 26-9 run to go up 96-91 on Stoudamire's fast-break layup.
"We showed a lot of character coming back from 12 down," Atlanta coach Mike Woodson said. "I thought Iverson was tremendous tonight. He created so many problems for us, but I like that we found a way to overcome that and get the win. We had a number of guys step up in the fourth quarter."
Sixers coach Maurice Cheeks could tell a big difference when center Samuel Dalembert picked up his fifth foul with 9:02 remaining.
"Our defense is a lot better with Sam in the game, because he can block shots and rebound the ball," Cheeks said. "They're a jump-shooting team, with the exception of Harrington. We just have to get better in all areas defensively."
Game notes
Iverson stayed home Thursday night to take care of an undisclosed personal matter before joining the Sixers for the morning shootaround Friday. ... Philadelphia F Michael Bradley did not make the trip because his wife was expecting to give birth. ... Johnson had eight assists. ... Webber added 16 points and 11 rebounds for the Sixers. ... Iverson, who leads the NBA in minutes, played the entire second half
throw exception 在 pennyccw Youtube 的最佳解答
The Philadelphia 76ers appeared
headed for their first loss of the season. Then Sportsmanship
Award winner Eric Snow was ejected for fighting.
Snow's shoving match with Tracy McGrady and ensuing ejection
sparked the 76ers, who rallied without their point guard for an
87-83 victory over the Orlando Magic.
The Sixers had just one free throw in the first five minutes of
the fourth quarter as the Magic opened a 72-68 lead. With 6:26
left, McGrady went up for a lane jumper and took exception to a
foul by Snow.
McGrady said something to Snow, who responded by putting his
finger in McGrady's chest. McGrady put both hands on Snow's
face and shoved him and both players were ejected.
"I said, `Get out of my face,'" Snow said. "He pushed me in the
face and I walked away clapping and they kicked us both out."
"I don't tough you, you don't touch me," McGrady said. "Don't
put your hands on me. And I retaliated after that. He touched
me and I reached out and that was that."
Snow sneered when his reputation as a hard but clean player was
brought up, while Magic coach Doc Rivers said his player should
have seen it coming.
"Sportsmanship? What's that got to do with anything?" Snow
said. "I didn't initiate it, you know what I'm saying? And I
don't care who you are in this league, you can be the best
samaritan in the world, but if someone pushes you, you got to
defend yourself."
"I try to tell Tracy that he is the target now," Rivers said.
"Guys are going to push and hit him, but if he's struggling
offensively, he can't get frustrated that he lets anybody get
under his skin."
Sixers players and coach Larry Brown argued the ejection of Snow
and center Theo Ratliff drew a technical foul. Orlando guard
Darrell Armstrong made the free throw for a 73-68 lead but the
Magic scored just seven points thereafter.
McGrady's departure hurt the Magic, who had to rely on a hobbled
Grant Hill and struggled to score down the stretch. Meanwhile,
Vernon Maxwell came on for Snow and teamed with fellow guards
Allen Iverson and Aaron McKie to score all of Philadelphia's 19
points in the final six minutes.
"Yeah, it fired us up. We were kind of (ticked) off," McKie
said. "McGrady takes a blow at his face and we get the stiff,
but we're a confident group. We've been in several games like
this throughout last season. You have to expect games like
this. These are the games you like to win."
Iverson scored 29 points and McKie contributed 14, drilling two
big 3-pointers down the stretch. Theo Ratliff added 14 points
and a career-high 17 rebounds for the Sixers (3-0), who won in
Orlando during the regular season for the first time since April
1, 1997, ending a five-game skid.
"These guys (Sixers) have been waiting for the opportunity to do
some big things out on the basketball court," Iverson said.
"They hear everything you write about us not having a shot
because we don't have the talent. But now, a lot of heads are
starting to turn and people recognize there's other guys that
are capable of doing big-time things in this league."
throw exception 在 Throwing an exception inside finally - Software Engineering ... 的推薦與評價
Basically, finally clauses are there to ensure proper release of a resource. However, if an exception is thrown inside the finally block, that guarantee ... ... <看更多>
throw exception 在 例外處理(Exception) - Java學習筆記 的推薦與評價
Exception 類別. 其子類別為各種例外物件,即 ... throw new IllegalArgumentException("b不得為0"); ... 在java中,除了現成的exception,我們也可以依需求自行製作。 ... <看更多>