函数可以@Throws针对单个异常进行注释,如下所示:
@Throws(NotFoundException::class)
Run Code Online (Sandbox Code Playgroud)
如何声明我的函数可以抛出多个异常(例如NotFoundException和NullPointerException)?
为什么 docker 为 Dockerfile 中的每个命令都启动一个容器? 我知道为每个命令创建了一个新层。
Step 1/3 : FROM nginx:latest
latest: Pulling from library/nginx
8ec398bc0356: Pull complete
dfb2a46f8c2c: Pull complete
b65031b6a2a5: Pull complete
Digest: sha256:8aa7f6a9585d908a63e5e418dc5d14ae7467d2e36e1ab4f0d8f9d059a3d071ce
Status: Downloaded newer image for nginx:latest
---> c7460dfcab50
Step 2/3 : WORKDIR /usr/share/nginx/html
---> Running in f8adb5dc5a47
Removing intermediate container f8adb5dc5a47
---> a59fb35a43c2
Step 3/3 : COPY . .
---> 7911d9a451d9
Successfully built 7911d9a451d9
Successfully tagged mynginx:latest
Run Code Online (Sandbox Code Playgroud)
当您无论如何要删除该容器时,创建一个新容器并在其中设置 WORKDIR 有什么意义?
注意这一行Removing intermediate container f8adb5dc5a47
我使用枚举类型作为对象的键:
enum Level {
Novice, Intermediate, Pro
}
type Players = { [key in Level] : string[]}
Run Code Online (Sandbox Code Playgroud)
在尝试仅使用新手和专业人士创建玩家类型的对象时,我收到错误消息说中级不存在:
const mapping: Players = {
[Level.Novice]: ["Neo"],
[Level.Pro]: ["John Wick"]
}
Run Code Online (Sandbox Code Playgroud)
我该如何让它发挥作用?