그냥 단순히 finally에 return이 있으면 finally 없으면 try나 catch구문의 return

이라고 이해해도 사용은 가능 하지만

실제로는 결정 과정이 좀 복잡하다.

According to ECMA-262 (5ed, December 2009), in pp. 96:

The production TryStatement : try Block Finally is evaluated as follows:

  1. Let B be the result of evaluating Block.
  2. Let F be the result of evaluating Finally.
  3. If F.type is normal, return B.
  4. Return F.

And from pp. 36:

The Completion type is used to explain the behaviour of statements (break, continue, return and throw) that perform nonlocal transfers of control. Values of the Completion type are triples of the form (type, value, target), where type is one of normal, break, continue, return, or throw, value is any ECMAScript language value or empty, and target is any ECMAScript identifier or empty.

It's clear that return false would set completion type of finally as return, which cause try ... finally to do 4. Return F.

 

참조: https://stackoverflow.com/questions/3837994/why-does-a-return-in-finally-override-try

'javascript' 카테고리의 다른 글

javascript] bind vs wrapper  (0) 2018.11.17
callback 패턴 함수를 await로 쓰는 방법  (0) 2018.05.01
nodeJs require  (0) 2018.04.13
함수형 프로그래밍 : reduce  (0) 2018.04.07
promise 대신 async, await를 사용하자  (0) 2018.03.22

엉뚱한 곳에서 설정이 덮어져서 설정을 아무리 고쳐도 반응을 안할 때가 있다.
끔찍한 뻘짓인데
지난번 router cors설정하다가 한번 그러고
이번에는 logger설정하다 또 그랬다.
그래도 이번에는 좀 딥한 설정방법을 알아낸건 다행?
은 무슨 앞으로 안쓸 것 같다. 그래도 이런 것도 있다는 정리

{
  "appenders": {
    "default": {
      "type": "stdout"
    },
    "default-filter": {
      "type": "logLevelFilter",
      "appender": "default",
      "level": "DEBUG",
      "maxlevel": "ERROR"
    },
    "error": {
      "type": "dateFile",
      "filename": "log/server/error.log"
    },
    "error-filter": {
      "type": "logLevelFilter",
      "appender": "error",
      "level": "ERROR",
      "maxlevel": "ERROR"
    }
  },
  "categories": {
    "default": {
      "appenders": ["default-filter", "error-filter"],
      "level": "INFO"
    }
  }
}```

appender에 logLevelFilter를 걸면 후킹하는 것처럼 최종 설정을 가로챌 수 있다.
이렇게 해놓고 또 반대로 설정 안바뀐다고 뻘짓 안했으면 좋겠다.
왜 제일 마지막에 있는 logger.level = 'debug'를 못봤을 까
그래서 처음할 때 바쁘다고 대충 때려 박으면 이렇게 된다.

mysql에서는 자세히 설명해주지 않고 번호로만 에러 종류를 알려준다.

  1. 2 해당경로에 mysql.sock 파일이 없을 경우
    my.cnf socket경로가 잘못되어이을 경우 그렇다.
    mysqld에서 띄운 소켓경로와
    mysql에서 찾는 소켓경로가 같아야 한다.
    계속 엉뚱한 경로를 찾는다면 cnf파일을 직접 지정해준다.
    mysql --defaults-file='소켓경로'

  2. 61
    mysql 원격 접속은 clinet ip별로 user가 생성이 돼서 host별 user를 만들어줘야 한다.

    create user '[username]'@'[hostname]' identified by '[password]';
    flush privileges;

    flush를 안해주면 create user가 적용이 안된다.
    hostname은 %를 사용하면 모든 hostname이 적용이 된다.

'Infra > database' 카테고리의 다른 글

Postgres function code 보는 법  (0) 2020.10.14
postgres 실행이 안될 경우  (0) 2020.10.12
MYSQL] my.cnf 위치 찾기  (0) 2020.07.17
mysql 수동 설치  (0) 2019.09.15

+ Recent posts