capstone-jicos / Ongi-server

MIT License
1 stars 1 forks source link

회원가입 error 리턴 #2

Closed dahunlim closed 6 years ago

dahunlim commented 6 years ago
{
    "name": "SequelizeUniqueConstraintError",
    "errors": [
        {
            "message": "PRIMARY must be unique",
            "type": "unique violation",
            "path": "PRIMARY",
            "value": "test",
            "origin": "DB",
            "instance": {
                "uniqueId": "test",
                "displayName": "dhdhd",
                "profileImage": "",
                "gender": "m",
                "country": "",
                "state": "",
                "city": ""
            },
            "validatorKey": "not_unique",
            "validatorName": null,
            "validatorArgs": []
        }
    ],
    "fields": {
        "PRIMARY": "test"
    },
    "parent": {
        "code": "ER_DUP_ENTRY",
        "errno": 1062,
        "sqlState": "23000",
        "sqlMessage": "Duplicate entry 'test' for key 'PRIMARY'",
        "sql": "INSERT INTO `users` (`uniqueId`,`displayName`,`profileImage`,`gender`,`country`,`state`,`city`) VALUES ('test','dhdhd','','m','','','');"
    },
    "original": {
        "code": "ER_DUP_ENTRY",
        "errno": 1062,
        "sqlState": "23000",
        "sqlMessage": "Duplicate entry 'test' for key 'PRIMARY'",
        "sql": "INSERT INTO `users` (`uniqueId`,`displayName`,`profileImage`,`gender`,`country`,`state`,`city`) VALUES ('test','dhdhd','','m','','','');"
    },
    "sql": "INSERT INTO `users` (`uniqueId`,`displayName`,`profileImage`,`gender`,`country`,`state`,`city`) VALUES ('test','dhdhd','','m','','','');"
}

쿼리 날리는거 오류 잡는거 했는데 여기서 뭘 날려줘야 처리를 해줄수있을까

lkaybob commented 6 years ago

아무래도 Primary Key가 증가가 안 된거 같은데?? 새로운 Primary Key를 어떤 방식으로 Assign했어?

서버 내 변수? 아님 디비에서 최댓값 확인?


Sung Hyuk “Lawrence” Kay Undergraduate Student @ Department of Software, Ajou University Lead of GDG Campus Korea

      1. 오후 2:44, dahunlim notifications@github.com<mailto:notifications@github.com> 작성:

{ "name": "SequelizeUniqueConstraintError", "errors": [ { "message": "PRIMARY must be unique", "type": "unique violation", "path": "PRIMARY", "value": "test", "origin": "DB", "instance": { "uniqueId": "test", "displayName": "dhdhd", "profileImage": "", "gender": "m", "country": "", "state": "", "city": "" }, "validatorKey": "not_unique", "validatorName": null, "validatorArgs": [] } ], "fields": { "PRIMARY": "test" }, "parent": { "code": "ER_DUP_ENTRY", "errno": 1062, "sqlState": "23000", "sqlMessage": "Duplicate entry 'test' for key 'PRIMARY'", "sql": "INSERT INTO users (uniqueId,displayName,profileImage,gender,country,state,city) VALUES ('test','dhdhd','','m','','','');" }, "original": { "code": "ER_DUP_ENTRY", "errno": 1062, "sqlState": "23000", "sqlMessage": "Duplicate entry 'test' for key 'PRIMARY'", "sql": "INSERT INTO users (uniqueId,displayName,profileImage,gender,country,state,city) VALUES ('test','dhdhd','','m','','','');" }, "sql": "INSERT INTO users (uniqueId,displayName,profileImage,gender,country,state,city) VALUES ('test','dhdhd','','m','','','');" }

쿼리 날리는거 오류 잡는거 했는데 여기서 뭘 날려줘야 처리를 해줄수있을까

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/capstone-jicos/Ongi-server/issues/2, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFY_Oe9vnTUjYO9TrJCpWBpmnJn4Cw8dks5uuQrWgaJpZM4YY_tU.

dahunlim commented 6 years ago

아니아니 저번에 회원가입할때 쿼리에서 오류났을때 오류 캐치하는거 한거거든 지금 응답을 저렇게 해주고 있는데 저걸 원한게 맞나 싶어서

lkaybob commented 6 years ago

[행아웃으로 이야기 완료함] 우선은 errors.type을 Message로 첨부해서 보내주는 걸로 하자요